0
Where do I put sorted() to sort my record?
I need help in printing the Employee ID from 1 to 5 in order. But I don't know where to enter the sorted() command. Any help appreciated. Thanks. https://code.sololearn.com/c4hJYEoCnj0y/?ref=app
2 Réponses
+ 4
if you have an unsorted list - let's call it list_ - then, instead of...
for element in list_:
...
... you can write:
for element in sorted(list_):
...
+ 1
ls = [5,3,4,1,2]
print(sorted(ls))