for i in range(3):
x=int(input("shuru :"))
l.append(x)
print (l)
print(sorted(l))
print(sorted(l,reverse=True)
l.sort()
print(l)
l.reverse()
print(l)
#!/usr/bin/python3
l=[]
for i in range(5):
x=int(input("shuru:"))
l.append(x)
print("chushi xulie",l)
print("linshi xulie <",sorted(l))
print("linshi daoxu >",sorted(l,reverse=True))
l.sort()
print("you xiaodao da",l)
l.sort(reverse=True)
print("youda daoxiao",l)
l.reverse()
print("dao xu xian shi ",l)
python--练习--列表排序sort,sorted,reverse=true,reverse
原文地址:http://blog.51cto.com/11972980/2093822