Sep-06-2019, 01:33 PM
Note that this code:
if password.isupper(): print("Password is not valid") else: if password.islower(): print("Password is not valid") else: if password.isnumeric(): print("Password is not valid") else: if len(intersection(characters, special_characters))==0: print("Password is not valid") else: if len(password)<6 or len(password)>12: print("Password is not valid") else: print('Valid password')Is equivalent to this code:
if password.isupper(): print("Password is not valid") elif password.islower(): print("Password is not valid") elif password.isnumeric(): print("Password is not valid") elif len(intersection(characters, special_characters))==0: print("Password is not valid") elif len(password)<6 or len(password)>12: print("Password is not valid") else: print('Valid password')That is, 'elif' in python is equivalent to 'else if' in many other languages. That's not going to fix the problems ThomasL pointed out, but it's definitely something you should use moving forward.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures