My code goes on an infinite loop;
I would expect the code to ask me for a number; but it never does. Because of that I think that the while loop becomes infinite, as x is never a float.
Why does this not work?
def is_even(x): x = raw_input("Write a number.") while x != float: print "That is not a number!" x = raw_input("Write a number.") if x/2 == int: return True else: return False
Also, if I modify the code to only accept float as inputs (x=float(raw_input("..."))), it says it can't convert a string to a float, but as I've said before, the actual thing never prompts. Why is that?