1+ import random
2+ letters = ['a' ,'b' ,'c' ,'d' ,'e' ,'f' ,'g' ,'h' ,'i' ,'j' ,'k' ,
3+ 'l' ,'m' ,'n' ,'o' ,'p' ,'q' ,'r' ,'s' ,'t' ,'u' ,'v' ,
4+ 'w' ,'x' ,'y' ,'z' ,'A' ,'B' ,'C' ,'D' ,'E' ,'F' ,'G' ,'H' ,'I' ,'J' ,
5+ 'K' ,'L' ,'M' ,'N' ,'O' ,'P' ,'Q' ,'R' ,'S' ,'T' ,'U' ,'V' ,'W' ,
6+ 'X' ,'Y' ,'Z' ]
7+ symbols = ['!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&' ,'*' ,'(' ,')' ,'+' ]
8+ numbers = ['1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,'0' ]
9+
10+ print ("Welcome to Password Generator!" )
11+
12+ n_letters = int (input ("How many letters would you like in your password?" ))
13+
14+ n_symbols = int (input ("How many symbol would you like?" ))
15+
16+ n_numbers = int (input ("How many numbers would you like?" ))
17+ password_list = []
18+ for i in range (1 ,n_letters + 1 ):
19+ char = random .choice (letters )
20+ password_list += char
21+ for i in range (1 ,n_symbols + 1 ):
22+ char = random .choice (symbols )
23+ password_list += char
24+ for i in range (1 ,n_numbers + 1 ):
25+ char = random .choice (numbers )
26+ password_list += char
27+ print (password_list )
28+ random .shuffle (password_list )
29+ print (password_list )
30+ password = ""
31+ for char in password_list :
32+ password += char
33+ print (password )
0 commit comments