+ 3
Python - Why is arr.sort() None?
arr = [34, 67, 34] print(arr.sort()) print(sorted(arr))
1 Answer
+ 5
arr.sort() modifies the list in place and doesn't return anything (when this happens Python adds a "return None"). It's supposed to be used alone:
arr.sort() # No print
https://www.quora.com/What-is-the-difference-between-sort-and-sorted-function-in-Python