Python Python Basics Types and Branching Comparing values

Why is this not if age <= 13 ?

I don't understand how you don't need to input 14 to pass this 13 barrier since it's = 13 and not <= 13

2 Answers

Jennifer Nordell
MOD
Jennifer Nordell
Treehouse Moderator

Hi there, Dante Matta-Echaurren ! I believe you're referring to the code in this question:

age = int(input("What is your age?  "))
if age < 13:
    print("Sorry you are not old enough to see this PG-13 movie")
else:
    print("Welcome to the movie")

We would have to put in 14 if that had been <=, but that's not what we want. The minimum age for PG-13 is 13. You must be at least 13 to watch the movie. That means that 13 year-olds are allowed to watch it. We don't want to exclude them here.

So if the age is less than 13, tell them they can't go in. Otherwise, let them in.

Hope this helps! :sparkles:

Oohhh ok i feel so stupid ! Thanks you very much for the comprehensive and throughout response.