What is the difference between sort() and sorted() in Python?
Correct answer
D. sort() changes the list in place; sorted() returns a new list
D. sort() changes the list in place; sorted() returns a new list
list.sort() mutates the original list, while sorted() works on any iterable and returns a new list.
Asked in: Python Interview Lists
https://docs.python.org/3/tutorial/datastructures.htmlNot sure why the answer is D? Ask here and get an explanation.