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 trialJustin Lee
Courses Plus Student 593 PointsExiting question, what's wrong with my code?
seems to have an issue exiting. Not sure what's wrong.
import sys
while True:
ask = input("Do you want to start the movie?")
if ask.lower() != "n":
print("Enjoy the show!"):
sys.exit()
else:
sys.exit()
2 Answers
karson Adam
32,623 Pointsyou have syntax error in print line ( unexpected colon ), and indentation error on first exit instruction. the correct code should be:
import sys
while True:
ask = input("Do you want to start the movie?")
if ask.lower() != "n":
print("Enjoy the show!")
sys.exit()
else:
sys.exit()
Justin Lee
Courses Plus Student 593 Pointstried it. system show: Bummer! Exception: EOF when reading a line
karson Adam
32,623 Pointsfor this chalenge do not use loop, try this:
import sys
ask = input("Do you want to start the movie?")
if ask.lower() != "n":
print("Enjoy the show!")
sys.exit()
else:
sys.exit()
Anthony Box
7,435 PointsAnthony Box
7,435 PointsLooks like you placed a colon at the end of your print statement. Also unindent the first sys.exit (syntax)!