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 trialRichard Hummel
Courses Plus Student 5,677 PointsAfter pressing 'n' game runs again?
In my code I wrote out the 'play_again' variable as shown in the video. However when I chose 'n' it comes back up and says to pick a number...I'm not sure why it keeps running. Also I should add...it only runs through the loop once after pressing 'n', on the second run it actually does exit the program.
3 Answers
andi mitre
Treehouse Guest TeacherHey Richard,
try using raw_input instead! This may be due to your python version
play_again = raw_input('Do you want to play again? y/n')
Cheers, Andi
john larson
16,594 PointsI have a question about Richards code. It looks to me like the second to last "else" is disjointed from any "if" statement. That I can see anyway. Am I missing something?
adham hamade
9,334 Pointsi have the same problem and it doesn't make sense, When i press n, it just starts over and raw_input doesn't work for me.
john larson
16,594 Pointsadham, can you post your code? I finally got mine working, maybe we can figure something out together.
adham hamade
9,334 Pointsthnx for the reply, i got it working. It was a stupid mistake where i forgot to put parenthesis next to .lower
john larson
16,594 Pointsoh yea, done that
Richard Hummel
Courses Plus Student 5,677 PointsRichard Hummel
Courses Plus Student 5,677 Points