python 中是否有此问题的任何代码来打印那些给定的数字并且问题指令是向下的?
is there any code of this question in python to print those given numbers and the question instruction is down blow?
给定以下用逗号分隔的数字 (",")
numbers="23,67,78,12,5,600,23,67,23,75"
降序排列
将您的答案显示为字符串并使用 printer() 函数
这段代码应该可以为您解决问题:
numbers = "23,67,78,12,5,600,23,67,23,75"
list = numbers.split(",") #Splitting the commas
list.sort(key=int, reverse=True) #sorting it into descending order
print(", ".join(list)) #Printing it out as a string
reverse=True
按降序打印出来,如下所示:
如果没有或使用 reverse=False
,您将按升序获得它们:
给定以下用逗号分隔的数字 (",")
numbers="23,67,78,12,5,600,23,67,23,75"
降序排列
将您的答案显示为字符串并使用 printer() 函数
这段代码应该可以为您解决问题:
numbers = "23,67,78,12,5,600,23,67,23,75"
list = numbers.split(",") #Splitting the commas
list.sort(key=int, reverse=True) #sorting it into descending order
print(", ".join(list)) #Printing it out as a string
reverse=True
按降序打印出来,如下所示:
如果没有或使用 reverse=False
,您将按升序获得它们: