Recently I am creating a function:
def TaxiFare(the_number_of_km):
if the_number_of_km >= 2:
return 24
elif the_number_of_km > 2:
return 24 + int((the_number_of_km - 2)/0.2) * 1.7
else:
return None
print('Something goes wrong !')
TaxiFare("Wrong")
I want to return None
and print 'Something goes wrong !'
when I input non-numerical values in the argument.
However, it turns out:
TypeError: '>=' not supported between instances of 'str' and 'int'
How can I fix it?