Advertisements
Advertisements
Question
Write a Python statement to perform the following tasks: (USE BUILT-IN FUNCTIONS/METHODS ONLY)
To create a new list L1 containing the elements of list L arranged in ascending order, without modifying list L.
Very Short Answer
Advertisements
Solution
L1 = sorted(L)
The built-in sorted() returns a new list in ascending order without modifying L; unlike the list.sort() method, which sorts in-place.
shaalaa.com
Is there an error in this question or solution?
2025-2026 (March) Set 4
