Python Python Basics (2015) Letter Game App Exiting

Charles Monaghan
Charles Monaghan
741 Points

I 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?

firedoor.py
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
Stuart Wright
41,064 Points

You 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'.

Charles Monaghan
Charles Monaghan
741 Points

I felt so stupid when I saw the mistake haha. I'll be sure to be careful with the logic next time!

You need to call .lower() on user, not on 'n'.

Charles Monaghan
Charles Monaghan
741 Points

Haha, thanks for this comment! I literally just figured that out a couple of seconds before you posted this haha.