Python Python Basics (2015) Number Game App Number Game Refinement

Cant figure out my issue with restarting game, after it has ended!

With the following code block (hopefully it sent, im quite new and cant seem to figure out how to post my code) every time i type "n" it will run the print("Bye!") but if i type anything other then n it wont play game()

play_again = input("Do you want to play again? Y/n: ")
    if play_again.lower() != 'n':
        game()
    else:
        print("Bye!")

2 Answers

Maybe "if play_again.lower()" should be starting right under "play_again = …"

Under the same column.

Not indented.

i believe you are correct, il check up on it and come back!

Jonathan Whelchel
Jonathan Whelchel
2,096 Points

I am having a different issue. Whenever I type in Y or n, I get an error saying Y or n is not defined.

play_again = input("Do you want to play again? Y/n ")

if play_again != 'n':
    game()

else: 
    print("Bye!")

Jonathan probably because you are not changing the input to a lower case - .lower()

Jonathan Whelchel
Jonathan Whelchel
2,096 Points

if play_again.lower() != 'n':

this is what I have written. but the user has to put in the quotes as well. why?