+ 2

Checking if an item is in an list

I am trying to help someone with a password validator, but I haven't used Python in a while. I tried making my own validator to understand the process but it won't work How can I check if the password matches any of the special characters? https://code.sololearn.com/cGoHMr16MO3X/?ref=app

26th Jul 2019, 8:16 AM
Clueless Coder
Clueless Coder - avatar
1 Antwort
+ 5
Here I wrote a function which will check for special characters. You need to iterate through each element of the string and check if it is in the list or not. chars = ["%", "^", "~", "|", "<", ">", "@"] def passCheck(str): for c in str: if c in chars: print('Special character, ' + c) else: print('Alphabet, ' + c) passCheck("%%%jdjdjdjdj")
26th Jul 2019, 8:36 AM
blACk sh4d0w
blACk sh4d0w - avatar