This piece of code keeps giving me the error "character " not defined and I don't understand what to do with it.Could someone please check through what I have done so far on the code and check for any mistakes.
At the top of your code, it should look like this
It is because of that character only exists in the menu function therefore if you take it outside the function and make it global it can be used anywhere in your application.
Hope that helps :)
@kiki2005 then you have some minor errors but I fixed it for you... I recommend to compare and contrast both and implement better syntax next time
global character print("Welcome to Password Checker") def menu(): print("Please enter a number that fits with one of the below.") print("1: Password Checker") print("2: Password Generator") print("3: Quit") menuSelection = int(input("...")) if menuSelection == 1: password = input("please enter a password") for c in password : if c.isspace() != True: character=0 character = character + 1 if character<=8: print ("this password is too short") if character>=24: print("this password is too long") else: point = 0 length = len(password) uppers = [x for x in password if x.isupper()] uppernum = len(uppers) lowers = [x for x in password if x.islower()] lowernum = len(lowers) point = point + length + (uppernum * 5) + (lowernum * 5) print(point)