I wanted to know if I could use type
like this:
media = input("Digite o numero: ")
média = input("Digite outro numero: ")
if media == type('str'):
print("oi")
else:
print("Tchau")
That is, to check if the variable media
is str
, and if it is, print a message.
If it is not, then it continues.
I wanted to use this for a calculator. If it puts something other than int
or float
, say that you can not put characters in that place.