I am developing a program where the user types a data, then I have to check if the value is number to proceed with the operation, but if it enters a non-numeric value it is alerted about the invalid value. >
I tried to use the type()
function but it checks the type of variable and not the value of it, so it is difficult given the fact that the function input()
returns the entry as string .
case = input(escolha um valor de 0 a 10)
if type(case) != int:
print("Digite apenas numeros!")
else:
#--processo
I thought of formatting input()
with int()
but if the user typed a non-numeric character the program will display error, when in fact I would like to handle this by asking her to enter only numbers.