-1

I have an if (else) statement in my code and but when I attempt to execute the code it does not run, but I do not get a notification that there is a syntax error etc. I think I may be missing something but I am not sure what...

This is my current code:

    NewUserOrOldUser= input ("Have you played this game before?")
    if NewUserOrOldUser is "yes":
    VerifyUn= input("Please enter the username you chose")
    VerifyPw= input("Please enter the password you chose")
    VerfifyUnPw= VerfiyUn + VerifyPw
    if VerifyUnPw in open("Un & Pw").read():
        print ("Proceed")
     else:
        print ("The data you inputted was incorrect, please try again")`
if NewUserOrOldUser is "no":

This is what happens when I run the code: image of my what happens when my code runs, the first question is asked but nothing happens after that

mhhabib
  • 2,975
  • 1
  • 15
  • 29
000
  • 1
  • 5
  • `if NewUserOrOldUser is "yes":` Use `==`. [Is there a difference between "==" and "is"?](https://stackoverflow.com/q/132988) – 001 Dec 09 '20 at 13:35
  • 1
    Also please read: https://stackoverflow.com/editing-help And [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/a/285557) – 001 Dec 09 '20 at 13:37

1 Answers1

0

You use if NewUserOrOldUser is "yes": To make your code run use if NewUserOrOldUser == "yes":

Also remove the last else block or put code there.

NewUserOrOldUser= input ("Have you played this game before?")
if NewUserOrOldUser == "yes":
    VerifyUn= input("Please enter the username you chose")
    VerifyPw= input("Please enter the password you chose")
    VerfifyUnPw= VerfiyUn + VerifyPw
    if VerifyUnPw in open("Un & Pw").read():
        print ("Proceed")
    else:
        print ("The data you inputted was incorrect, please try again")
HilbertB
  • 352
  • 1
  • 2
  • 12