Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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