按照他提示的代码输出整数5,为啥不走下面了,结果输出了param type error和None
def my_abs(x):
if not isinstance(x, int) or not isinstance(x, float):
print('param type error.')
return None
if x >= 0:
return x
else:
return -x
print(my_abs(5))
def my_abs(x):
if not isinstance(x, int) or not isinstance(x, float):
print('param type error.')
return None
if x >= 0:
return x
else:
return -x
print(my_abs(5))
2021-05-25
举报