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!
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 trial
Python Basics / Letter Game / Code Challenge / "Exiting"
so, below code works to pass the challenge.... but it throw NameError: name 'what_was_inputted" is not defined. i am using v2.7.11 does it make any difference with v3.0 in this case?
import sys movie = input("Do you want to start watching movie? Y/N") for letter in movie: if letter == "n" or letter == "N": sys.exit() else: print("Enjoy the show!")
OK, this is sorted now,
there is no problem with indentation, basically for python-2.7 ALWAYS use
Here try this:
import sys movie = input("Do you want to start watching movie? Y/N") if movie.lower()=='n': sys.exit() else: print("Enjoy the show!")
your solution not to use "for" loop look better but still not working.
It just needs to be properly indented- I just typed it, I didn't run it.