+ 2
Is there a way to generate special chars in python .
There must be an easy way to generate these characters, can someone help me ? Password Validation ALPHABETS = [ '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', ] SPECIAL_CHARS = [ '!', '@', '#', '
#x27;, '%', '&', '*', ] NUMBERS = [ '1', '2', '3', '4', '5', '6', '7','8','9','0', ] def checker(pwd): letters = [] chars = [] num = [] for char in pwd: if char in ALPHABETS: letters.append(char) if char in NUMBERS: num.append(char) if char in SPECIAL_CHARS: chars.append(char) if len(pwd) >= 7 and len(chars) >= 2 and len(num) >= 2: return "Strong" else: return "Weak" print (checker (input()))4 Respostas
+ 1
No worries, I added an index slice, it should help with isolating the data you want, but you can also change the range function too
+ 3
something like this?
https://code.sololearn.com/cKO5mp5l81kc/?ref=app
+ 2
Thanks
+ 2
There are built-in string constants that can be used for many groups of character types.
https://docs.python.org/3/library/string.html