3. is_int


I am not sure where to start though, how to include integers vs. float but 7.0 is considered a interger when actually is a float?

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


def is_int(x):
    if x % x != 0:
        return True
        return False


Hint! If you substract x as an integer from x and it equals 0, x is an integer, right?


I did it this way as well, and i was trying to think of a way to explain it without giving the answer, good answer! :slight_smile:


I dunno if this helps but I i made x == always an integer hint hint "int" , if not then I made it return False


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