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

Raiyan Ahmad
Raiyan Ahmad
3,622 Points

whats wrong

?

firedoor.py
n = input('dou you want to watch a movie?')
if n != 'n' or'N':
    print('Enjoy the show! ')
else:
    sys.exit()

2 Answers

Miles Aylward
Miles Aylward
13,225 Points

Your code is correct for the most part just a few minor things. you can't use or there because you have to test to ensure that it isn't 'n' and it isn't 'N' so you need to use the 'AND' keyword. And you must restate the variable for the second comparison operator.

if n != 'n' and n != 'N':
Thomas Fildes
Thomas Fildes
22,687 Points

Hi Raiyan,

Please see my code below which I used to pass this challenge:

import sys

question = input("Do you want to start the movie?")

if question != "n" and question != "N":
    print("Enjoy the show!")
else:
    sys.exit()

Everything in your code looks good apart from the "or" you used after your first condition in the if statement. You are to use "and" in replacement of this and it should work.

Hope this helps! Happy coding!!!