What is the difference between list.sort() and sorted() in Python?

Learn the difference between Python’s built-in list sorting methods and when one is preferred over the other.


This content originally appeared on 30 seconds of code and was authored by 30 seconds of code

Learn the difference between Python’s built-in list sorting methods and when one is preferred over the other.


This content originally appeared on 30 seconds of code and was authored by 30 seconds of code


Print Share Comment Cite Upload Translate
APA
30 seconds of code | Sciencx (2022-11-29T13:34:40+00:00) » What is the difference between list.sort() and sorted() in Python?. Retrieved from https://www.scien.cx/2020/12/31/what-is-the-difference-between-list-sort-and-sorted-in-python/.
MLA
" » What is the difference between list.sort() and sorted() in Python?." 30 seconds of code | Sciencx - Thursday December 31, 2020, https://www.scien.cx/2020/12/31/what-is-the-difference-between-list-sort-and-sorted-in-python/
HARVARD
30 seconds of code | Sciencx Thursday December 31, 2020 » What is the difference between list.sort() and sorted() in Python?., viewed 2022-11-29T13:34:40+00:00,<https://www.scien.cx/2020/12/31/what-is-the-difference-between-list-sort-and-sorted-in-python/>
VANCOUVER
30 seconds of code | Sciencx - » What is the difference between list.sort() and sorted() in Python?. [Internet]. [Accessed 2022-11-29T13:34:40+00:00]. Available from: https://www.scien.cx/2020/12/31/what-is-the-difference-between-list-sort-and-sorted-in-python/
CHICAGO
" » What is the difference between list.sort() and sorted() in Python?." 30 seconds of code | Sciencx - Accessed 2022-11-29T13:34:40+00:00. https://www.scien.cx/2020/12/31/what-is-the-difference-between-list-sort-and-sorted-in-python/
IEEE
" » What is the difference between list.sort() and sorted() in Python?." 30 seconds of code | Sciencx [Online]. Available: https://www.scien.cx/2020/12/31/what-is-the-difference-between-list-sort-and-sorted-in-python/. [Accessed: 2022-11-29T13:34:40+00:00]
rf:citation
» What is the difference between list.sort() and sorted() in Python? | 30 seconds of code | Sciencx | https://www.scien.cx/2020/12/31/what-is-the-difference-between-list-sort-and-sorted-in-python/ | 2022-11-29T13:34:40+00:00
https://github.com/addpipe/simple-recorderjs-demo