-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLecture41.py
More file actions
36 lines (28 loc) · 1.17 KB
/
Copy pathLecture41.py
File metadata and controls
36 lines (28 loc) · 1.17 KB
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
import random
print("Welcome to the PyPassword Generator!")
letters = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
symbols = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_', '+', '=', '{', '}', '[', ']', ':', ';', '"', "'", '<', '>', ',', '.', '?', '/','\\','|','~','`']
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
nletters = int(input("How many letters would you like in your passsword? \n"))
nsymbols = int(input("How many symbols would you like? \n"))
nnumbers = int(input("How many numbers would you like? \n "))
password=""
for i in range(1,nletters):
r1 = random.choice(letters)
password += r1
for j in range(1,nsymbols):
r2 = random.choice(symbols)
password += r2
for k in range(1,nnumbers):
r3 = random.choice(numbers)
password += r3
print(password)
list_pass = list(password)
random.shuffle(list_pass)
new_password = ''.join(list_pass)
print(new_password)