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
Bartłomiej Kuczma
903 PointsCan't pass this test.
''' import sys q = input("do you want to start a movie?".lower) if (q != "n"): print("Enjoy the show!") else: sys.exit() '''
Whats is wrong with this code? It works just fine in compiler. wow I can't even format it in right way...
2 Answers
Alexander Davison
65,469 PointsWithout you formatting your code properly, it is hard to tell where your errors are.
However, there are a couple errors in plain sight even without formatting:
- You need parentheses () after
lower. This is because it is a function. - You need to move the use of the
lowerfunction outside theinputfunction call. - You need to CAPITALIZE the very first letter of "do you want to start a movie?".
I'm pretty sure this would work:
import sys
watch_movie = input("Do you want to start a movie? ").lower()
if watch_movie != 'n':
print("Enjoy the show!")
else:
sys.exit()
Bartłomiej Kuczma
903 PointsThanks guys! That was very helpfull! :)
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsTo format your code properly, you shouldn't use this symbol: '
You can find the backtick symbol (`) on the very top-left corner of your keyboard, usually. It is also very commonly under the
esckey on your keyboard.