Is_int passing even the output is wrong


When i give input as 4 which is an int the output of my code is False and i pass the test.

Am i missing something ?

def is_int(x):
    if x == int(x):
        return True
        return False

print is_int(raw_input())


What are you trying to do here?


calling function is_int as well as passing the argument taken by the user and then printing the output which returns


The return of the raw_input function is a string. So I guess you need to convert it to float first.


try this:

print is_int(float(raw_input("Enter a number:")))