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 trialAdrian Brenton
8,110 PointsHello all I'm unsure how to solve this challenge. I've tried a function also - no luck, please advise, many thanks
I've tried defining a function for this, to no avail, and am a bit stuck with this challenge.
Not sure if my logic is flawed, or if I'm making a silly mistake with this one here.
Help would be very much appreciated!
Many Thanks
import sys
start_movie = input("Do you want to start the movie? Y/n")
if start_movie != "n" or "N":
print("Enjoy the show! ")
else:
sys.exit()
1 Answer
Steve Hunter
57,712 PointsHi Adrian,
You have to write the conditional tests in full; you can't use or
like that.
You'd need to have:
if start_movie != "n" or start_movie != "N":
However, working through your logic, you'd need both to be !=
so you should use and
. Alternatively, use .lower()
to simplify the tests:
if start_movie.lower() != "n":
I hope that helps,
Steve.
Adrian Brenton
8,110 PointsAdrian Brenton
8,110 PointsMany thanks Steve - much appreciated!
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsNo problem!