-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpasswordgenerator.py
51 lines (46 loc) · 1.13 KB
/
passwordgenerator.py
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
49
50
51
'''
import string
import random
if __name__ == "__main__":
s1 = string.ascii_lowercase
# print(s1)
s2 = string.ascii_uppercase
# print(s2)
s3 = string.digits
# print(s3)
s4 = string.punctuation
# print(s4)
passwordlenght = int(input("Enter Password Lenght\n")) #Todo1: Handle Gibberish
s = []
s.extend(list(s1))
s.extend(list(s2))
s.extend(list(s3))
s.extend(list(s4))
# print(s)
random.shuffle(s) # THE MOST IMP CODE
# print(s)
print("Your Password is:")
print("".join(s[0:passwordlenght]))
'''
import string
import random
if __name__ == "__main__":
s1 = string.ascii_lowercase
# print(s1)
s2 = string.ascii_uppercase
# print(s2)
s3 = string.digits
# print(s3)
s4 = string.punctuation
# print(s4)
passwordlenght = int(input("Enter Password Lenght\n")) #Todo1: Handle Gibberish
s = []
s.extend(list(s1))
s.extend(list(s2))
s.extend(list(s3))
s.extend(list(s4))
# print(s)
# random.shuffle(s) # THE MOST IMP CODE
# print(s)
print("Your Password is:")
print("".join(random.sample(s, passwordlenght)))