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 Python Basics (2015) Letter Game App Exiting

how come my code did call the sys.exit()??

this is what i under stand from the code i wrote: import the system libery

get the user input

if the user input different than "n" or user input different than "N":

  then print Enjou the show


 exit the system(sys.exit())
import sys
start_movie = input ( 'Do you want to start a movie Y/n')
if start_movie != 'n' or start_movie != "N":
    print("Enjoy the show")

1 Answer

5,944 Points

When an OR clause is evaluated, any condition that is true makes the whole OR clause true.

  • If your input is 'N', your OR clause would be True OR False which evaluates as True
  • If your input is 'n', your OR clause would be False OR True which evaluates to True

Try replacing your or with an and. Optionally you could call the .lower() method on start_movie and get rid of the OR clause altogether.