हिंदी

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 - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

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.

अति संक्षिप्त उत्तर
Advertisements

उत्तर

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
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2025-2026 (March) Set 4

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×