Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit b9ecdcb

Browse files
authored
Merge pull request #24 from Mitesh2499/master
Send Pull Request
2 parents 5f0894b + 67c37b7 commit b9ecdcb

File tree

7 files changed

+83
-91
lines changed

7 files changed

+83
-91
lines changed
Lines changed: 43 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,43 @@
1-
import random
2-
import math
3-
<<<<<<< HEAD
4-
alpha = "abcdefghijklmnopqrstuvwxyz"
5-
num = "0123456789"
6-
special = "@#$%&*"
7-
8-
# pass_len=random.randint(8,13) #without User INput
9-
pass_len = int(input("Enter Password Length"))
10-
11-
# length of password by 50-30-20 formula
12-
alpha_len = pass_len//2
13-
num_len = math.ceil(pass_len*30/100)
14-
special_len = pass_len-(alpha_len+num_len)
15-
16-
17-
password = []
18-
19-
20-
def generate_pass(length, array, is_alpha=False):
21-
for i in range(length):
22-
index = random.randint(0, len(array) - 1)
23-
character = array[index]
24-
if is_alpha:
25-
case = random.randint(0, 1)
26-
if case == 1:
27-
character = character.upper()
28-
password.append(character)
29-
30-
31-
# alpha password
32-
generate_pass(alpha_len, alpha, True)
33-
# numeric password
34-
generate_pass(num_len, num)
35-
# special Character password
36-
generate_pass(special_len, special)
37-
# suffle the generated password list
38-
random.shuffle(password)
39-
# convert List To string
40-
gen_password = ""
41-
for i in password:
42-
gen_password = gen_password + str(i)
43-
print(gen_password)
44-
=======
45-
alpha="abcdefghijklmnopqrstuvwxyz"
46-
num="0123456789"
47-
special="@#$%&*"
48-
49-
#pass_len=random.randint(8,13) #without User INput
50-
pass_len=int(input("Enter Password Length"))
51-
52-
#length of password by 50-30-20 formula
53-
alpha_len=pass_len//2
54-
num_len=math.ceil(pass_len*30/100)
55-
special_len=pass_len-(alpha_len+num_len)
56-
57-
58-
password=[]
59-
60-
def generate_pass(length,array,is_alpha=False):
61-
62-
for i in range(length):
63-
index=random.randint(0,len(array)-1)
64-
character=array[index]
65-
if is_alpha==True:
66-
67-
case=random.randint(0,1)
68-
if case==1:
69-
character=character.upper()
70-
71-
password.append(character)
72-
73-
#alpha password
74-
generate_pass(alpha_len,alpha,True)
75-
#numeric password
76-
generate_pass(num_len,num)
77-
#special Character password
78-
generate_pass(special_len,special)
79-
80-
#suffle the generated password list
81-
random.shuffle(password)
82-
83-
#convert List To string
84-
gen_password=""
85-
for i in password:
86-
gen_password=gen_password+str(i)
87-
88-
print(gen_password)
89-
90-
91-
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
1+
import random
2+
import math
3+
4+
alpha = "abcdefghijklmnopqrstuvwxyz"
5+
num = "0123456789"
6+
special = "@#$%&*"
7+
8+
# pass_len=random.randint(8,13) #without User INput
9+
pass_len = int(input("Enter Password Length"))
10+
11+
# length of password by 50-30-20 formula
12+
alpha_len = pass_len//2
13+
num_len = math.ceil(pass_len*30/100)
14+
special_len = pass_len-(alpha_len+num_len)
15+
16+
17+
password = []
18+
19+
20+
def generate_pass(length, array, is_alpha=False):
21+
for i in range(length):
22+
index = random.randint(0, len(array) - 1)
23+
character = array[index]
24+
if is_alpha:
25+
case = random.randint(0, 1)
26+
if case == 1:
27+
character = character.upper()
28+
password.append(character)
29+
30+
31+
# alpha password
32+
generate_pass(alpha_len, alpha, True)
33+
# numeric password
34+
generate_pass(num_len, num)
35+
# special Character password
36+
generate_pass(special_len, special)
37+
# suffle the generated password list
38+
random.shuffle(password)
39+
# convert List To string
40+
gen_password = ""
41+
for i in password:
42+
gen_password = gen_password + str(i)
43+
print(gen_password)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
this is file one
2+
this is file one this is file one this is file one this is file one this is file one this is file one
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is file two
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is file three
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is hello world
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
this is python file
2+
learn python
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os
2+
3+
text = input("input text : ")
4+
5+
path = input("path : ")
6+
7+
# os.chdir(path)
8+
9+
10+
def getfiles(path):
11+
f = 0
12+
os.chdir(path)
13+
files = os.listdir()
14+
# print(files)
15+
for file_name in files:
16+
abs_path = os.path.abspath(file_name)
17+
if os.path.isdir(abs_path):
18+
getfiles(abs_path)
19+
if os.path.isfile(abs_path):
20+
f = open(file_name, "r")
21+
if text in f.read():
22+
f = 1
23+
print(text + " found in ")
24+
final_path = os.path.abspath(file_name)
25+
print(final_path)
26+
return True
27+
28+
if f == 1:
29+
print(text + " not found! ")
30+
return False
31+
32+
33+
getfiles(path)

0 commit comments

Comments
 (0)