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 trialBrent Liang
Courses Plus Student 2,944 PointsCode Challenge Wrong Response
import sys
response = input("Wanna start the movie?")
def start_movie(response):
if response == 'n' or 'N':
sys.exit()
else:
print("Enjoy the show!")
What's wrong with this? Why wrong response?
1 Answer
Name:GoogleSearch orJonathan Sum
5,039 Pointsimport sys
response = input("Wanna start the movie?")
def start_movie(response):
if response == 'n' or response == 'N':
sys.exit()
else:
print("Enjoy the show!")
start_movie(response)
#in line 4 ,i have added the missing variable "reponse" after the "or". That is how we use the or statment
#in the end of the coding, you also need to add the function you wrote ,which is start_movie(response), inorder to tell the script that you are using the function you wrote.
#i hope you can understand my hell poor english that no1 understands it.
#i hope you can find a job too.
#happy with python
Brent Liang
Courses Plus Student 2,944 PointsThank you Jonathan.
Your code is correct.
And i understand your English perfectly. Good luck with finding a job too.
Name:GoogleSearch orJonathan Sum
5,039 PointsName:GoogleSearch orJonathan Sum
5,039 PointsTwo things,you are mising a variable "response" after the word "or" in line 4. Therefore,you need to change the "if response == 'n' or "N" :" to "if response =="n" or response == "N":" This is the first thing that you need to correct. Second,you don't really need to set it up a function "start_movie" ,but it is ok. If you set it in function, you have to use the function by adding the start_movie(response) at the next line ,else you are not using the function that you wrote.