-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpasswordgen.py
36 lines (26 loc) · 964 Bytes
/
passwordgen.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
import random
import string
print("welcome to the pi password Generator")
def password():
password = ""
letters = input("How many letters would you like in your password? ")
if letters:
letters = int(letters)
for char in range(letters):
password += random.choice(string.ascii_letters)
symbols = input("How many symbols would you like? ")
if symbols:
symbols = int(symbols)
for sym in range(symbols):
password += random.choice(string.punctuation)
numbers = input("How Many numbers would you like? ")
if numbers:
numbers = int(numbers)
for num in range(numbers):
password += str(random.randint(0,9))
password = list(password)
random.shuffle(password)
for element in password:
generate_password = ''.join(password)
print(f'your password is {generate_password}')
password()