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 trialWarren Chisasa
3,731 PointsThe use of the sys library
I am trying to use the system library but I am unable to exit. The notification I am getting is 'didn't exit start_movie (my variable)'. Asking for help!
import sys
start_movie = input("Do you wanna watch a movie!?")
if start_movie != 'n' or start_movie !='N':
print("Enjoy the show!")
else:
sys.exit()
1 Answer
Sahil Sharma
4,791 Pointsthe sys.exit() function is working in your code it is just that the if condition is always executed in this code, you can use start_movie.lower() != 'n' as a condition of the if statement (as you would not have to account for capitalized inputs)