Python Python Basics (2015) Letter Game App Exiting

Help please

Get this bummer: Didn't get an exit from 'start_movie' What?
import sys

start = input("Do you want to start the movie? ")
if start != "N" or start != "n":
    print("Enjoy the show!")

2 Answers

Jennifer Nordell
Jennifer Nordell
Treehouse Staff

Hi there! You're close... really close. You are off by one word. You used the word or, but you need the word and.

Let's take a look at your logic for a minute. Remember, for an expression in an or statement only one has to be true for the entire thing to be true. So if we were to send in "N", what happens? It asks if "N" is not equal to "N". That evaluates to false so it moves to the next part of the or statement. It then asks if "N" is not equal to "n". It is not so this evaluates to true which means that the "Enjoy the show!" prints. This is obviously not what was intended.

The same thing is true for the "n". It first asks if "n" is not equal to "N". This evaluates to true and the next condition is never even checked. It goes directly to printing "Enjoy the show!".

Instead, we need to say that if the answer was both not equal to "N" and not equal to "n", then exit. As your code is currently, there is nothing the user can type which results in the else statement being reached.

Hope this helps! :sparkles:

Ben Reynolds
Ben Reynolds
35,167 Points

In your if statement, both of the conditions need to be checked so use "and" instead of "or".

In fact I'd go one further and simplify it like this:

if start.lower() != "n"

Then you don't need to do two checks at all. I can see why it was confusing though, that is a weird error message. It implies you have to name something "start_movie" but that's not actually a requirement, you could name your input variable whatever you want.