if type(variable) == int or type(variable) == float: isNumber = True
myVariable = input('Enter a number') if type(myVariable) == int or type(myVariable) == float: # Do something else: print('The variable is not a number')