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 trialJakub Matyszewski
1,945 Points'Exiting' Task: Exception: EOF when reading a line
When I do this code in the python shell on my computer it's fine, but in the treehouse workspace it returns this error... (Exception: EOF when reading a line)
import sys
while True:
if input("Do you wanna show? ").lower() != 'n':
print("Enjoy!")
else:
sys.exit()
1 Answer
Mason Frye
8,870 PointsYou should put the input in the while loop. You should also assign the input to a variable instead of putting it in the if statement. Try this
import sys
user_input = input("What to watch? ")
if user_input.lower() != "n":
print("Enjoy the show!")
else:
sys.exit()
Chris Brainerd
5,385 PointsChris Brainerd
5,385 PointsSame error here, treehouse didn't seem to want the 'while True:' bit