说明:定义
返回单值
def my_abs(x):
if x >= 0:
return x
else:
return -x
返回多值
返回多值就是返回一个tuple
import math
def move(x, y, step, angle=0):
nx = x + step * math.cos(angle)
ny = y - step * math.sin(angle)
return nx, ny
空函数
def nop():
pa <weixin_38584043> 上传 | 大小:63kb