-
Notifications
You must be signed in to change notification settings - Fork 0
/
Password.py
41 lines (30 loc) · 991 Bytes
/
Password.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
import string
import random
characters = list(string.ascii_letters + string.digits + "!@#$%^&*()-=_+?;:<>,.[]{}/`~")
def generate_password():
password_length = int(input("How long would you like your password to be? "))
random.shuffle(characters)
password = []
for x in range(password_length):
password.append(random.choice(characters))
random.shuffle(password)
password = "".join(password)
print(password)
option = input("Do you want to generate another password? (y/n): ")
if option == "y":
generate_password()
elif option == "n":
print("Program ended")
quit()
else:
print("Invalid input, please input y or n")
quit()
option = input("Do you want to generate a password? (y/n): ")
if option == "y":
generate_password()
elif option == "n":
print("Program ended")
quit()
else:
print("Invalid input, please input y or n")
quit()