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 trialcharlesmonaghan
742 PointsI tried this out in the console and it works fine?
I'd love to know what I did wrong? I did everything in the instructions and I also put it into workspaces and it worked like a charm.
Do you know the problem?
import sys
def start_movie():
user = input("Do you want to start the movie? Y/n ")
if user != 'n'.lower():
print("Enjoy the show!")
else:
sys.exit()
start_movie()
2 Answers
Stuart Wright
41,120 PointsYou have the right idea, but your logic isn't quite correct:
if user != 'n'.lower():
'n'.lower() is just 'n', always. And we're not translating the user variable to lowercase. So if I input 'N', it will say "Enjoy the show!". To fix this, you need to use the .lower() method on user, rather than 'n'.
Niko Klanecek
3,152 PointsYou need to call .lower()
on user
, not on 'n'
.
charlesmonaghan
742 PointsHaha, thanks for this comment! I literally just figured that out a couple of seconds before you posted this haha.
charlesmonaghan
742 Pointscharlesmonaghan
742 PointsI felt so stupid when I saw the mistake haha. I'll be sure to be careful with the logic next time!