```
def is_int(x):
if type(x) == int:
return True
else:
return False
```

I know i am doing something wrong (hence not letting me through)

But can someone explain me why this is wrong?

```
def is_int(x):
if type(x) == int:
return True
else:
return False
```

I know i am doing something wrong (hence not letting me through)

But can someone explain me why this is wrong?

Is_int

because that would be very simple and not a challenge? For this challenge, negative numbers (-7) and floats with decimal zero (2.0) should also be considered integer. they are not considered integers by int

You have to test one more thing?

Back to theory of lesson..

**For the purpose of this lesson, we'll also say that a number with a decimal part that is all 0s is also an integer, such as 7.0.**

**This means that, for this lesson, you can't just test the input to see if it's of type int.**

so you have to also test for numbers like 3.00, 5.00, 5.000...meaning if a number have it's decimal part = 0, you have to return `True`

.

Without creating a separate Hint section, they included the hint at the bottom of the description:

"If the difference between a number and that same number rounded down is greater than zero, what does that say about that particular number?"

Can you figure out a way to test for that?

This could be done using several ways. I think the key is to determine if x equals to int(x).

if x == int(x):

return True

**OR**

elif abs(x-int(x))==0:

return True

From my understanding, the point of this forum is to help educate and guide students into the correct direction when solving a problem. As a moderator, I would have expected more than just "Cause that would be too simple?" from you. I could have helped him better and I am struggling with this problem too. I have seen some of your other posts and they do seem to be more criticizing than educational at times.

It took me a while to figure out myself, but I eventually got it. Python will normally classify any number with a decimal as a float even if the decimal is 0. The lesson wants you to create a function that tests if a number is a float or an int, and it wants you to classify a given number that ends with ".0" as an int. "If the difference between a number and that same number rounded down is greater than zero, what does that say about that particular number?" Think about that question.

For example, if x equals 7.5, then 7.5 minus 7 (or x rounded down) would equal 0.5, which is greater than zero. That means that number is a float. I used that principle to get the answer. What helped me was to research how to use the round() function.

Thanks for the effort, but that was more of a rhetorical question to try to help the original poster. Thuesen has already tried to use a simple integer test, but as was previously stated, that is not in the spirit of the exercise.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.