Apr-05-2017, 10:46 AM
Hi, I'm creating a password score program, everything seems to be fine until you enter a password with only symbols. It comes out saying that both upper and lower case letters were used. I need a way to distinguish symbols from upper and lower case letters.
#This program allows the user to see how good the security of his password is based on a point system. pts = 0 print ("Hello! Welcome to the Password Score Calculator!") name = input ("What is your name? ") PW1 = input ("What is your password? ") PW2 = input ("Please type it again to secure a match. ") while PW2 != PW1: PW1 = input ("Unfortunately,they did not match. Please re-enter your password. ") PW2 = input ("Please type it again to secure a match. ") if PW2 == PW1: print ("Secured.") if len(PW1) >= 8: print ("+5 Points") pts += 5 if PW1.isupper(): print ("Please use lowercase and uppercase letters.") elif PW1.islower(): print ("Please use lowercase and uppercase letters.") else: print ("+10 Points") pts += 10 import re if any (PW1.isdigit()for PW1 in PW1): print ("+10 Points") pts += 10 symbols = "~`!@#$%^&*()/_-+={}[]:>;',</?*-+" contains_symbol = False for symbols in symbols: if symbols in PW1: contains_symbol = True pts += 5 print ("+5 Points") break