#元组类型 元组只能读取,不能改写
s=(1,3,2,3,4,5)
print(s)
print(type(s))
#在函数参数末尾使用*参数,元组就是可变参数,只能放到参数末尾
def fun(x,y,*args):
print(x,y,args)
fun(1,2)
fun(1,2,3)
fun(1,2,3,4)
#求最大值
def max(*agrs):
print(agrs)
m=agrs[0]
for i in range (len(agrs)):
if m<agrs[i]:
m=agrs[i]
return m
print(max(1,2))
print(max(1,2,3))
python基础复习(33)--元组()
猜你喜欢
转载自blog.csdn.net/xt18971492243/article/details/112261179
今日推荐
周排行