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 trialyeshi chopal
1,445 PointsUse 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
15,353 Pointsyou need to import the sys library
You forgot a semicolon (:) at the end of your if statement
You had to use double equals (==) instead of a single one in your if statement because we are comparing
do answer.lower() != "n" isntead of what you got. otherwise you have to do this:
answer != "n" or answer != "N"
Isaac Al-Wahaibi
6,522 Pointsadd 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()
yeshi chopal
1,445 Pointsthank you !
Kutay Yavuz
1,387 Pointsimport 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
yeshi chopal
1,445 Pointsyeshi chopal
1,445 Pointsthanks