Hi Friends……Welcome again to our session on Methods in Python Lists. In the previous session, we had a detailed understanding about Python Lists. We will extend this session now to see how we can make use of the lists and some pre-defined methods and functions to be used with Python Lists.
Lets start our session on Methods in Python Lists:
1. sort method on integers — Python Lists provides us with an in-build method to sort the list. Instead of sorting the list by manually comparing list elements one by one, we can directly make use of sort function.
list = [10,5,67,34,7] print("Actualy list is:",list) list.sort() print("Sorted list is:",list)