Aug-24-2020, 10:21 AM
I'm using the following code:
if score == 1 or score == 2: # if a weak password is created asks the user to try again print("This is a weak password, please try again") password = input("Please enter the new password:") elif score == 3 or score == 4: # if a mediocre password is given asks the user whether they want to try again retry = input("This is a weak password, do you want to try again? (y/n)") if retry == "y": # if yes they restart the loop password = input("Please enter the new password:") else retry == "n": # if no the loop is closed try_again = False else score == 5: # if strong password is given closes the loop print("That is a strong password") try_again = False return New_passwordBut I get this syntax error:
Error: File "c:/Users/djwil/Documents/python/learning python/Chapter 19 - Chunky Challenges/Passwords.py", line 62
else retry == "n": # if no the loop is closed
^
SyntaxError: invalid syntax
But I'm not sure what's incorrect about my code. I can upload the full code if necessary the above is just a few lines of it.