日期0703Python练习005
输入三个整数x,y,z,请把这三个数由小到大输出
冒泡法:
list1 = [] for i in range(4): x = input("请输入整数") x = int(x) list1.append(x) for a in range(1,4): for b in range(0,4-a): if list1[b] > list1[b+1]: list1[b],list1[b+1] = list1[b+1],list1[b] print(list1)
函数法:sort()
list1 = [] for i in range(4): x = input("请输入整数") x = int(x) list1.append(x) list1.sort() print(list1)