kiki2005 (5)

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.

You are viewing a single comment. View All
YatinBayya (18)

@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 = character + 1
if character<=8:
       print ("this password is too short")
if character>=24:
       print("this password is too long")
  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)