def is_int(x): if type(x) is int: return True else: return False

Here is my code to check if x is integer, however it returns always with such error:
“Oops, try again. Your function fails on is_int(7.0). It returns False when it should return True.”

/by the way how to insert a code formatted with 4 spaces?/

I just wanted to point out that in the instructions it states:

For the purpose of this lesson, we’ll also say that a number with a decimal part that is all 0s is also an integer, such as 7.0.

This means that, for this lesson, you can’t just test the input to see if it’s of type int.

That said… Combined with methadwikarina said, try a different method for checking if a number is an integer that compares the number and an integer check of that number in order to solve the problem.

And there is a very didactic explanation, using Python, about modules in this Youtube video:
Advanced Arithmetic, Modulus and flor Division, from Computer Science UK

When x is a whole number with a decimal point and a fractional value, say 3.14,

x = 3.14
print x % 1 # 0.14000000000000012

or to rid all the floating point effects,

print "%.2f" % (x % 1) # 0.14

So we see that the opertion returns only the decimal fraction portion of a float. When the return is zero, the float is treated as an integer equivalent, hence, 1.0 % 1 == 1 % 1 returns True.