#Johnny解法1
def johnny(value):
try:
x=float(value)
if x.is_integer():
return "int"
else:
return "float"
except ValueError:
return "str"
value=input("Please input :")
print(johnny(value))
#Johnny解法2
def johnnysuper(value):
try:
int(value)
return "int"
except ValueError:
pass
try:
float(value)
return "float"
except ValueError:
return "str"
value=input("Please input :")
print(johnnysuper(value))
#Johnny解法3
def johnnysuper(value):
try:
value.isdigit()==True
return "int"
except ValueError:
pass
try:
float(value)
return "float"
except ValueError:
return "str"
value=input("Please input :")
print(johnnysuper(value))