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 trialNitin Kakkar
5,223 PointsHow do i do the sys exit program
Pls help me find out what's wrong
import sys
def start_movie():
movie = input("Want to watch the show. Y/n").lower
if movie != "n":
return("Enjoy the show!")
else:
sys.exit()
2 Answers
dojewqveaq
11,393 PointsHey Nitin,
couple of things here. First, instead of returning the result, the task wants you to print it. And also, you don't need to use a function in this task. But if you do, remember to call it or your code won't do much. Here is how I solved it not using a functino:
import sys
movie = input("Want to watch the show. Y/n").lower()
if movie != "n":
print("Enjoy the show!")
else:
sys.exit()
Here is a solution using a function:
import sys
def start_movie():
movie = input("Want to watch the show. Y/n").lower()
if movie != "n":
print("Enjoy the show!")
else:
sys.exit()
start_movie()
Nitin Kakkar
5,223 PointsThx
Iain Simmons
Treehouse Moderator 32,305 PointsIain Simmons
Treehouse Moderator 32,305 PointsYou would still need to call the
start_movie
function at the end: