built-in functions
maximum = max(5, 8, 9)print maximumminimum = min(1, 4, 2)
print minimum
absolute = abs(-42)
print absolute print type(42)
print type(4.2)
print type('spam') def distance_from_zero(ds):
if type(ds) == int or type(ds) == float:
return abs(ds)
else:
return 'Nope'
頁:
[1]