+ 2
What is the difference between sort and sorted ?
Sort() Sorted()
6 Answers
+ 8
The difference of sort() and sorted() in short words:
sort() - using sort() will change (sort) the passed list to the function inline, that mean that the original list will be sorted. sort() only works for lists.
sorted() - using sorted() will take any iterable (list, tuple, string, dict), not only list, and will return a new sorted iterable.
+ 5
Nithish
Helper for lists. It's only start for me after your question:)
https://code.sololearn.com/c9jF0Ha9oCio/?ref=app
+ 4
list.sort() - Sorts the list.
sorted(list) - Returns a sorted copy of the list.
+ 3
Thanks kiibo
It is very easy to understand