Im stuck


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>

```python

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

INSTRUCTIONS:
Define a function is_int that takes a number x as an input.
Have it return True if the number is an integer (as defined above) and False otherwise.

ERROR:
Oops, try again. Your function fails on is_int(-2). It returns False when it should return True.

<do not remove the three backticks above>

#2

ERROR:

Oops, try again. Your function fails on is_int(-2). It returns False when it should return True.

If you call the function with -2 argument ( is_int(-2) ) then It returns False But it should return True.

if x== int:

In that lesson you can’t just test the input to see if it’s of type int.

try something else

Hint

you can use round() method.


#3

if round(x)-x==0:

I TRIED THIS AND NOTHING HAPPENED! :frowning:


#4

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