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

Shadow Skillz
Shadow Skillz
3,020 Points

Didn't get an exit from start_movie? Im really curious as to why my code is not working it just won't run pls help

Not really sure what is missing or how the compiler wants me to write this script

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

1 Answer

Carlos Federico Puebla Larregle
Carlos Federico Puebla Larregle
21,074 Points

A few tips here, you have to be careful with the indentation, try always to keep the same indentation. Another thing, you have to store the result from the input function so you can then check it out in an if statement. You can do it like this:

import sys

start_movie = input('Do you want to watch a movie')
if start_movie not in ['n', 'N']:
    print("Enjoy the show!")
else:
    sys.exit()

I hope that helps a little bit.

Shadow Skillz
Shadow Skillz
3,020 Points

Thanks for your help carlos i really appreciate it i do need to keep the indentation in mind, the editor is so weird when it checks the scripts i had some cases where the input didn't have to be assigned to a variable and still worked its just confusing at times.