3. is_int


Why isn't my code being accepted?

def is_int(x):
    if x == int(x):
        print True
    elif abs(x) == int(x):
        print True
        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."


your code prints True, it doesn't return True


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


You can also simplify the above as follows:

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


this was the problem.
Thank you so much!