【发布时间】:2022-09-29 22:36:11
【问题描述】:
我有这个问题。
ClassA1=[7.8,5.6,8.7,8.9,9,9.5]
ClassA2=[6.0,6.5,9.3,9.2,7.5]
choice=int((input(\"Press 1 if you want to sort the scoreboard in ascending order.\\n. Press 2 if you want to sort the scoreboard in descending order.\"))
total = lopA1+lopA2
if choice == 1:
print(total.sort())
elif choice == 2:
print(total.sort(reverse=True))
运行后我输入 1 或 2
None
-
total.sort()对列表进行就地排序并返回无。你想要total.sort(),然后是print(total)