[Solved] How to test if a number is an integer or a float that only has a zero after the decimal?


A very simple test, which works because Python integers are unlimited in resolution:

return float(x) == int(float(x))

The result from raw_input isn’t a number, it’s a string. That’s why it has to be converted to float first.

11

solved How to test if a number is an integer or a float that only has a zero after the decimal?