# Max's Original Solution # password = input("Enter password: ") # contain_digit = False # length = len(password) # while contain_digit == False and length < 8: # for char in password: # if char.isnumeric(): # contain_digit = True # break # else: # contain_digit = False # password = input("Enter valid password: ") # length = len(password) password = input("Enter password: ") valid = False while not valid: # Check whether there's a digit contains_digit = False for char in password: if not contains_digit and char.isnumeric(): contains_digit = True valid = contains_digit and len(password) > 8 if not valid: password = input("Enter valid password: ") print("Valid Password")