Informatics Practices

What will be the output of the following statement?

list1 = [12, 32, 65, 26, 80, 10]
list1.sort()
print(list1)

Python List Manipulation

2 Likes

Answer

[10, 12, 26, 32, 65, 80]

Working

In the above code, list1 is initialized as [12, 32, 65, 26, 80, 10]. The sort() method is then called on list1, which arranges its elements in ascending order. After sorting, list1 becomes [10, 12, 26, 32, 65, 80].

Answered By

1 Like


Related Questions