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

Use input() to ask the user if they want to start the movie. If they answer anything other than "n" or "N" print "Enjoy

answer = input("Do you want to start the movie")
if answer = "n" or "N"
   print("Enjoy the show!")
else:
   sys.exit()

help please!

3 Answers

Kevin Faust
Kevin Faust
15,353 Points
  1. you need to import the sys library

  2. You forgot a semicolon (:) at the end of your if statement

  3. You had to use double equals (==) instead of a single one in your if statement because we are comparing

  4. do answer.lower() != "n" isntead of what you got. otherwise you have to do this:

 answer != "n" or answer != "N"

thanks

add import sys , so you can use sys.exit(), also in if statement you have something wrong , if they type "n" it will show "Enjoy the show"

hope this helps

import sys

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

if answer.lower() != "n":
    print("Enjoy the show")
else:
    sys.exit()

thank you !

Kutay Yavuz
Kutay Yavuz
1,387 Points

import sys a = input("Wanna watch a movie?? y/n") if a !="n": print("Enjoy the show!") else: sys.exit()

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

its working