-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode of passgen
More file actions
50 lines (33 loc) · 794 Bytes
/
code of passgen
File metadata and controls
50 lines (33 loc) · 794 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import string
import random
s1 = string.ascii_lowercase
#print(s1)
s2 = string.ascii_uppercase
#print(s2)
s3 = string.digits
#print(s3)
s4 = string.punctuation
#print(s4)
s = []
s.extend(list(s1))
s.extend(list(s2))
s.extend(list(s3))
s.extend(list(s4))
#print(s)
random.shuffle(s)
#passlen = int(input("Enter the length of your password"))
check=True
while check==True:
passlen = (input('Enter password length in positive integers: \n'))
if passlen.isdigit()==True:
passlength=int(passlen)
check=False
else:
print("Oops! Enter only positive integer. ")
continue
#print(s)
#print("Your password is: ")
#print("".join(random.sample(s,passlen)))
#print("".join(s[0:paslen]))
passw=''.join(s)
print(passw[0:passlength])