The elements of a list could be sorted using the sort() method:
random_list = [8, 7, 5, 2, 2, 5, 7, 5, 6, 4] >>> random_list.sort() >>> random_list [2, 2, 4, 5, 5, 5, 6, 7, 7, 8]
When a list consists of a collection of strings, they are sorted in the alphabetical order:
>>> day_of_week = ['Monday', 'Tuesday', 'Thursday', 'Friday', 'Saturday'] >>> day_of_week.sort() >>> day_of_week ['Friday', 'Monday', 'Saturday', 'Thursday', 'Tuesday']