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 (2015) Logic in Python Conditional Value

Karolis Raškauskas
Karolis Raškauskas
1,013 Points

How to compare none type to an integer?

How should compare and make variable that is none equal "true" while using if? (I know that my code far from being correct)

conditions.py
admitted = None
int age
if not admitted > age:
    print "true"

2 Answers

I think you misread the instructions, it says IT will create the age variable for you and test your condition, you don't create it yourself and even if you did, that's an invalid way of creating a variable.

Your if statement isn't right either, you're supposed to just test if age is greater than or equal to 13, and if so, set admitted to True

Karolis Raškauskas
Karolis Raškauskas
1,013 Points

Thanks. I didn't get what I was supposed to do at first :D