《挑战程序设计》python实现 1.6.1

时间:2021-06-09 19:20:34

记录一下学习过程

str1 = input('请输入长度')

list1 = [int(i) for i in str1.split()]
max1 = max(list1)
list1.remove(max1)
mid1 = max(list1)
list1.remove(mid1)
min1 = max(list1)
list1.remove(min1)
while min1 <= max1 - mid1:
    max1, mid1, min1 = mid1, min1, max(list1)
    list1.remove(min1)
print(max1,mid1,min1)