这道Python题初学者应该怎么做,只是一道列表题,又该怎么做,最后之一道题应该要怎么解答
问题描述:
这道Python题初学者应该怎么做,只是一道列表题,又该怎么做,最后之一道题应该要怎么解答
答
num_list=[]
for i in range(5):
s=int(input('请输入第'+str(i+1)+'个数:'))
num_list.append(s)
print('输入后的列表为',num_list)
num_list.sort()
print('排序后的列表为',num_list)
for i in num_list:
print(i)
如果有帮助,帮忙采纳下,多谢!
答
先用sort方法排序,再用for循环输出