How to order a list in Python

0 min

Python lists come with a sort method that we can use to order a list in Python

# We define a list example
student_list = ["Bob", "Alfred", "James", "Brice", "Caroline"]

# We order the list
student_list.sort()

# We print the ordered list.
print(student_list)

Here you are ! You now know how to order a list in Python.

Don't hesitate to bookmark this page !