3. is_int


#1


Why isn't my code being accepted?

def is_int(x):
    if x == int(x):
        print True
    elif abs(x) == int(x):
        print True
    else:
        print False

When I call the function with -2 it returns "True" but I keep getting an error message that says:
"Oops, try again.Your function fails on is_int(-2). It returns None when it should return True."


#2

your code prints True, it doesn't return True


#4

Err... Why the elif statement? Eliminating that, it should solve it and please return not print the logic.


#5

You can also simplify the above as follows:

def is_int(x):
    return (x == int(x))


#6

this was the problem.
Thank you so much!