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

Timothy Van Cauwenberge
Timothy Van Cauwenberge
8,958 Points

Didn't get an exit from `start_movie`

How come I received this error and how should I fix it?

firedoor.py
import sys

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

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

1 Answer

You are close, but you've called .lower() on the wrong object to achieve the desired result. The way you've written your code, you are turning "n" into a lowercase n, which does nothing since it's already lowercase. You want to turn the variable you are comparing to "n" into a lowercase string before the comparison, so that if the user inputs "N", it gets converted to "n" and thus matches the if ... == "n": statement.