Sorting a list of numbers is a common task in Python programming. In this blog post, we’ll explore different codeexamples that demonstrate how to sort a list of numbers efficiently using built-in functions.

Example 1:

numbers = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5] numbers.sort() print(numbers)

Output:

[1, 1, 2, 3, 3, 4, 5, 5, 5, 6, 9]

Example 2:

numbers = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5] sorted_numbers = sorted(numbers) print(sorted_numbers)

Output:

[1, 1, 2, 3, 3, 4, 5, 5, 5, 6, 9]