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

about import sys; and sys.exit()

I get a response of "didnt get the right response" I don't understand why

firedoor.py
import sys
def start_movie():
  start = input("Do you want to start the movie? y/n ").lower()
  if start != "n" or "N":
    print("Enjoy the show!")
  else:
    sys.exit()

2 Answers

Ryan Ruscett
Ryan Ruscett
23,309 Points

Hola,

Oh you were so close, actually you are kind of right. So that's good. You are at least on the right track.

First thing is first. Your start variable. You are .lower(). But then you say if start is not equal to n or N. Which means you are checking for both uppercase and lowercase. Which defeats the purpose of trying to make start lower() meaning lowercase. But that is a minor issue.

The main reason as to why this is happening is because you created a function. The test isn't trying to execute a function. It's just trying to run the code. If it were trying to execute a function. There would have to be an if main=="main"

YOUR CODE:

import sys
def start_movie():
  start = input("Do you want to start the movie? y/n ").lower()
  if start != "n" or "N":
    print("Enjoy the show!")
  else:
    sys.exit()

Just remove the function from the equation, don't bother making start lower() when asking for input. Make the start lower() during the comparison. Then you should be all set to go.

MY CODE

import sys

start = input("Do you want to start the movie? y/n ")
if start.lower() != "n":
  print("Enjoy the show!")
else:
  sys.exit()

Does that make sense? If not let me know and I can try to explain it another way.

thank you for the help! :)