赞
踩
第一种:
a=[1,2,3,4,5,6,7,8,9,10,11]
i=0
while i<len(a)//2:
a[i],a[len(a)-(i+1)]=a[len(a)-(i+1)],a[i]
i+=1
print(a)
第二种:
a=[1,2,3,4,5,6,7,8,9,10]
for i in range(len(a)//2):
a[i],a[len(a)-i-1]=a[len(a)-i-1],a[i]
print(a)
第三种:
a=[1,2,3,4,5,6,7,8,9,10]
a.sort(reverse=True) # 倒叙
print(a)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。