3/15 my code

def is_int(x):
    a = str(float(x))
    p1 = int(a.split(".")[0])
    if p1 - x == 0:
        return True
        return False



Your code is prone to errors. If you are going to use the built in type check you might as well do this.

def is_int(data):
        return int(data)
    except TypeError:
        print("You failed to enter valid information")

You can of course change what some of this does but it should get my point across.

If you put in a string into your function it will flip it's wig.


Thanks @zeziba, that's a good suggest.


def is_int(x):
return x%1==0

I think it's the simplest solution.