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

Valeria Brigatti
Valeria Brigatti
20,820 Points

I get an error when I want to play again

I'm using the same code as the one in the video and the download file. When I guess the number and I'm asked if I want to play again, I get this error, both entering y or n:

Traceback (most recent call last): File "number_game.py", line 34, in <module> game() File "number_game.py", line 28, in game play_again = input("Do you want to play again? Y/n") File "<string>", line 1, in <module> NameError: name 'n' is not defined

Can anybody help me solve this issue, please?

3 Answers

Jeff Wilton
Jeff Wilton
16,626 Points

Did you forget quotes around the 'n' on this line?

if play_again.lower() != 'n'

Valeria Brigatti
Valeria Brigatti
20,820 Points

No I did not forgot any quote. I also tried with "n" but I get the same error. As I said, it's the exact same code as the one given by Kenneth Love.