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

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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

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.