-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassword Generator002.py
More file actions
36 lines (32 loc) · 1.13 KB
/
Password Generator002.py
File metadata and controls
36 lines (32 loc) · 1.13 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("This is a password generator. \nPress Y for YES and N for NO.")
n=int(input("Enter length of password you want: "))
passwordstack=list()
password=''
digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
locase = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h','i', 'j', 'k', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
upcase = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H','I', 'J', 'K', 'M', 'N', 'O', 'p', 'Q','R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y','Z']
symbols = ['@', '#', '$', '%', '=', ':', '?', '.', '/', '|', '~', '>','*', '(', ')']
print('''
1:Numbers only
2:Uppercase only
3:Lowercase only
4:Uppercase+Lowercase only
5:Uppercase+Lowercase+Digits
6:Mix Set''')
c=int(input("Your choice: "))
if c==1:
passwordstack+=digits
elif c==2:
passwordstack+=upcase
elif c==3:
passwordstack+=locase
elif c==4:
passwordstack+=upcase+locase
elif c==5:
passwordstack+=upcase+locase+digits
elif c==6:
passwordstack+=upcase+locase+digits+symbols
for i in range(0,n):
password+=random.choice(passwordstack)
print("Your Random Password is : ",password)