Determine the value returned by the function.
by Bernie '21
def is_percent(x):
if type(x) == float or type(x) == int:
if x <= 100 and x >= 0:
return str(x)
elif x > 100:
return "Too high"
else:
return "Too low"
else:
return "Invalid"
Function Call | Return Value | |||
---|---|---|---|---|
is_percent(2.5) | → | |||
is_percent("Water") | → | |||
is_percent(107) | → | |||
is_percent(-12) | → | |||
is_percent(90) | → |
Experiment with this code on Gitpod.io