Is_int(x) of a negative x


#1




is_int(-2)
returns False


is_int(-2)
should return True


def is_int(x):
    if x>0:
        x=x*10
    else:
        x=x*-1
        x=x*10
    if x//10==0:
        return True
    else:
        return False


#2

for x is 2, so first you will make the number positive:

x=x*-1

then you multiply it by 10:

x=x*10

then:

if x // 10 == 0

x is 20, so 20 // 10 is 2, not sure how you now confirm the number is actually a integer


#3

Didn't notice i used // instead of %
fixed it and my code worked, thanks.


#4