Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialalekseibingham
4,491 PointsCant 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
Saman Bir
Courses Plus Student 724 PointsMaybe "if play_again.lower()" should be starting right under "play_again = …"
Under the same column.
Not indented.
Saman Bir
Courses Plus Student 724 PointsJonathan probably because you are not changing the input to a lower case - .lower()
Jonathan Whelchel
2,096 Pointsif play_again.lower() != 'n':
this is what I have written. but the user has to put in the quotes as well. why?
alekseibingham
4,491 Pointsalekseibingham
4,491 Pointsi believe you are correct, il check up on it and come back!
Jonathan Whelchel
2,096 PointsJonathan Whelchel
2,096 PointsI 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 ")