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

Christian A. Castro
Christian A. Castro
30,501 Points

Exiting Challenge: Any suggestions?

import sys

movie = input("Start the movie?")
if movie != 'n' or 'N':
    print("Enjoy the show!")
else: 
    sys.exit()
firedoor.py
import sys

movie = input("Start the movie?")
if movie != 'n' or 'N':
    print("Enjoy the show!")
else: 
    sys.exit()
Omar Abu Hamdan
Omar Abu Hamdan
794 Points

you just have to use "and" instead of "or"

1 Answer

jonlunsford
jonlunsford
15,480 Points

The code challenge is looking for an exit using the sys module. You have sys.exit() in the 'else' case, but you need to add one in the if movie != ... case also. For instance...

if movie != 'n' or 'N' :
    print("Enjoy the show!")
    sys.exit()
else:
    sys.exit()
Christian A. Castro
Christian A. Castro
30,501 Points

jonlunsford Thank you for your quick response! I didn't know that I needed to use the sys.exit method on the if statement as well.