natural: [0, 1, 2 ... 8]
Python 2
it_is = unicode(user_input).isnumeric()
Python 3
it_is = str(user_input).isnumeric()
integer: [-8, .., -2, -1, 0, 1, 2, 8]
try:
int(user_input)
it_is = True
except ValueError:
it_is = False
float: [-8, .., -2, -1.0...1, -1, -0.0...1, 0, 0.0...1, ..., 1, 1.0...1, ..., 8]
try:
float(user_input)
it_is = True
except ValueError:
it_is = False