To sort the list [1, 3, 4, 2, 5] in ascending order in Python, you can use the built-in sort()
function of Python which modifies the original list.
main.py56 chars4 lines
Output:
main.py16 chars2 lines
If you want to create a new sorted list without changing the original list, you can use the built-in sorted()
function.
main.py81 chars4 lines
Output:
main.py16 chars2 lines
gistlibby LogSnag