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

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 Teacher

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,170 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.