思路:
将5个整数做成列表,运用 sorted函数将列表元素的值从小到大排序,然后利用切片反转列表元素.
a = int(input(">> "))
b = int(input(">> "))
c = int(input(">> "))
d = int(input(">> "))
e = int(input(">> "))q =[a, b, c, d,e]
q = sorted(q)
q = q[::-1]
print(q)
输入35, 55, 33, 55, 66
思路:
将5个整数做成列表,运用 sorted函数将列表元素的值从小到大排序,然后利用切片反转列表元素.
a = int(input(">> "))
b = int(input(">> "))
c = int(input(">> "))
d = int(input(">> "))
e = int(input(">> "))q =[a, b, c, d,e]
q = sorted(q)
q = q[::-1]
print(q)
输入35, 55, 33, 55, 66