Test Index

Python Revision Tour Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 82 of 102
Marks: +1, -0
Fill in the blank.
_____ function is used to arrange the elements of a list in ascending order.
[CBSE 2023 Set 4]
Solution:  
Concept:
list.sort() arranges the elements of the list in place, in ascending order by default (sort(reverse=True) for descending).
Explanation:
L = [30, 10, 20]
L.sort()
print(L) # [10, 20, 30]
arrange(), ascending() and asort() are not list methods in Python.
Answer:
Option A (sort())
© examsnet.com
Advertisements
Go to Question: