用户输入,其中输出将按降序排序。
例如,输入一个数字:
你想输入更多:
如果是打印输入另一个数字
如果回答否
打破argument并按降序对输出进行排序。
我已经用于raw_input查询和使用while 循环来运行代码。但它仅按降序对第一个输出和最后一个输出进行排序
a = raw_input("Enter a number: ")
while True:
b = raw_input("Do you want to input more: ")
c = raw_input("Enter another number:")
if b == 'yes':
print (c)
continue
elif b == 'no':
my_list = [a,c]
my_list.sort(reverse=True)
print(my_list)
break
我希望代码能够成功运行
Enter a number:2
Do you want to input more:yes
Enter another number:3
Do you want to input more:yes
Enter another number:4
Do you want to input more:no
[4,3,2]
元芳怎么了
LEATH
慕仙森
相关分类