- 设置默认参数
def f(x,n=2):
y = x**n
return y
- 可变参数设置,返回值为元组
def f(*x):
print(x)
def f():
le = float(input("输入矩形长度="))
wd = float(input("矩形宽度="))
area = le*wd
zc = (le+wd)*2
print("矩形面积为%f\n" % area)
print("矩形周长为%f\n" % zc)
f()
#输入矩形长度=4.6
#矩形宽度=5.3
#矩形面积为24.380000
#矩形周长为19.800000