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 trial

Python Python Basics (2015) Letter Game App Exiting

Justin Lee
PLUS
Justin Lee
Courses Plus Student 593 Points

Exiting question, what's wrong with my code?

seems to have an issue exiting. Not sure what's wrong.

firedoor.py
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()
Anthony Box
Anthony Box
7,435 Points

Looks like you placed a colon at the end of your print statement. Also unindent the first sys.exit (syntax)!

2 Answers

you 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
Justin Lee
Courses Plus Student 593 Points

tried it. system show: Bummer! Exception: EOF when reading a line

for 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()