CBSE Class 11 Informatics Practices Question 45 of 80

Lists in Python — Question 8

Back to all questions
8
Question

Question 8(a)

What will be the output of the following statement?

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

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].

Answer