Python 15. Practice Makes Perfect Exercise 1.3: is_int
I get the following error code after trying many different answer combinations I thought should have worked:
'Oops, try again. Your function fails on is_int(-2). It returns None when it should return True.'
Below is an example of one of the codes I thought should have worked that returns:
Then 'Oops, try again. Your function fails on is_int(-2). It returns None when it should return True.'
I added the is_int(-2) at the bottom of the code to further test the results and it returns True..
I'm pretty confused, usually I figure out what I'm doing wrong eventually.. But I'm stuck, any advice?
What am I doing wrong?
def is_int(x): if x - round(x) == 0: print True else: print False is_int(-2)