Advertisements
Advertisements
Question
What will be the output of the following statement?
list1 = [12,32,65,26,80,10]
sorted(list1)
print(list1)Short/Brief Note
Advertisements
Solution
The sorted() function takes a list as a parameter and creates a new list consisting of the same elements arranged in sorted order. It doesn’t change the list which is passed as a parameter itself.
OUTPUT:
[12, 32, 65, 26, 80, 10]
shaalaa.com
Lists in Python
Is there an error in this question or solution?
