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

Miika Vuorio
Miika Vuorio
3,579 Points

I don't understand what I'm doing wrong in a challenge task?

You can see the code there. The task was: Use input() to ask the user if they want to start the movie. If they answer anything other than "n" or "N", print "Enjoy the show!". Otherwise, call sys.exit(). You'll need to import the sys library.

firedoor.py
import sys

to_watch = input("Do you want to start the movie? ")
if to_watch.lower != "n":
    print("Enjoy the show!")
else:
    sys.exit()

1 Answer

You've almost got it. A bit of advice though, utilize the python terminal emulator and the python documentation it would have helped you realize your problem.

# first this would have been the output had you worked through the problem in the terminal
>>> ans = "N"
>>> ans.lower
<built-in method lower of str object at 0x7f525c5713b0>
>>> ans.lower()
'n'
>>> 

Based off that data you are calling a method of a type string, inorder to invoke the action you must 'call it'

import sys

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

# Notice below I added the parentheses to the end of lower
if to_watch.lower() != "n":
    print("Enjoy the show!")
else:
    sys.exit()
Miika Vuorio
Miika Vuorio
3,579 Points

Is there a way to see the error message in the code challenges or do I have to do it in an IDE or terminal and then copy paste?