这类似于我正在学习编写代码的书中的示例。我有一个函数,希望根据“ for”构造的参数对输入数据进行排序,但不会对数据进行排序。我究竟做错了什么?我正在学习,要变得温柔! :)
def sort_high_to_low(user_prompt="Please enter the amount of stands you want to enter sales for: "):
user_input = int(input(user_prompt))
for count in range(1,user_input + 1):
prompt = "Please enter the sales for stand " + str(count) + ": "
sales.append(read_int(prompt))
print(sales)
for sort_pass in range(0,len(sales)):
for count1 in range(0,len(sales)-1):
if sales[count1] < sales[count1 + 1]:
temp = sales[count1]
sales[count1] = sales[count1+1]
sales[count1+1] = temp
sort_high_to_low()