## 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. # Simple way to ask python to check if a number is/is not/ a float.

For the code challenge after creating a number game, I was asked to create a function that would return True if the number entered is even, and False, if the number entered is odd. The code that let me pass the challenge is below.

```def even_odd(number):
if number % 2 == 0 :
return True
else:
return False
```

My question: Why can't I write this code? (please ignore indentation, i'm not sure how to format code on this website yet.)

```def even_odd(number):
if number % 2 == float :
return False
else:
return True
```

Surely, python recognizes what a 'float' is, so why can't it check whether or not a number is a float this way? I don't even understand how the code that let me pass the challenge works. Say 5 is the number entered. 6 % 2 = 3, by my understanding of this logic, the code should return false, because the resulting integer is not equal to 0. How does this work. Please help me understand.

```isinstance(number, float)