# Is_int problem!

#1

I've already tried this codes but i keep getting this error:
Oops, try again. Your function fails on is_int(-2). It returns None when it should return True.
the codes:
1.
def is_int(x):
if round(x)==x:
print True
else:
print False
2.
def is_int(x):
if type(x)==int:
print True
else:
print False
3.
def is_int(x):
if round(x)-x==0:
print True
else:
print False

``Replace this line with your code.``

#2

The operative word here is `return`.

#4

How did you know that you should use round() ???

#5

Ok here instead of using the round() function in your code try my code which is given below and check whether you get a go ahead as i got and also if u think mark it as a solution

def is_int(x):
temp = x - int(x)
if temp == 0:
return True
else:
return False

for the explanation:
here we first calculate the value of temp by subtracting the integer part of x with original value of x (explicit type conversion as in code). Then if temp >0 it means there is a fractional part and hence the number is not an integer and return False OTHERWISE return True

Is_int
#6

thanks for your help buddy

#7

Thank U:slight_smile:

#8

Most Welcome Bro

#9

You answer is really clever good job

#10

There is only one problem. The instructions specifically state that we are not to use the `int()` function in our solution. If `clever` means disobey the instructions, then I guess it can be called a good job. Recommend find another solution that does not use, `int()`.

#11