InterviewSolution
Saved Bookmarks
| 1. |
Write a short note about sort( )? |
|
Answer» sort( ) function sorts the element in list. Syntax: List.sort (reverse = True/False, Key = myFunc) Both arguments are optional
Example My List=[‘Thilothamma’ , ’Tharani’ , ‘Anitha’ , ‘SaiSree’ , ‘Lavanya’] MyList.sort( ) print(MyList) Output: [‘Anitha’ , ‘Lavanya’ , ‘SaiSree’ , ‘Tharani’ , ‘Thilothamma’] |
|