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

What am I doing wrong in this code?

import sys

option = input("Play movie?") if option == "n" or "N": sys.exit()

else: print("Enjoy the show!")

firedoor.py
import sys

option = input("Play movie?")
if option == "n" or "N":
  sys.exit()

  else:
    print("Enjoy the show!")

1 Answer

Kourosh Raeen
Kourosh Raeen
23,733 Points

You have an indentation problem with else. Also, you need to write option == again after or:

import sys

option = input("Play movie?")
if option == "n" or option == "N":
  sys.exit()
else:
    print("Enjoy the show!")

Take a look at this,im sure theres no indentation problem with else. Please have a look! :)

import sys

option = input("Play movie?")
if option == "n" or option == "N":
  sys.exit()
  else:
    print("Enjoy the show!")
Kourosh Raeen
Kourosh Raeen
23,733 Points

This looks like your original code. Did you make the changes I suggested?

Kourosh Raeen
Kourosh Raeen
23,733 Points

The else should be at the same indentation level as the if.

im sorry, copied the wrong code. fixed it!

ahhhhhh. forgot that! 3 months no python and skill beginning to rust! thanksssss!