-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCode.py
More file actions
30 lines (25 loc) · 750 Bytes
/
Code.py
File metadata and controls
30 lines (25 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import random
import string
def passwd(num):
for i in range(0,num-3):
yield random.choice(string.ascii_letters)
for i in range(0,2):
yield random.choice(string.digits)
for i in range(0,1):
yield random.choice(string.punctuation)
ans=input("Do you want a strong or a weak password")
password=""
if (ans=="Strong"):
num=int(input("Enter the number of characters in password"))
for char in passwd(num):
password=password+char
password=''.join(random.sample(password,len(password)))
print(password)
else:
list=["ibieb","oheo","puqw","lkkoehd","oiei"]
count=0
while(count<2):
i=random.randrange(0,4)
count+=1
password=password+list[i]
print(password)