DAY 13(CODE INFINITY)

Today we study about list methods as we have discussed about lists in previous blog so I hope lists are very clear in mind that they are changeable so we apply different methods according to our need. we se uses of every method here I give you brief about every method in easy language. There are following list methods:

1.Sort: This method sort the list in ascending order original list is updated.

you can call this as sort subtype if you need list in descending order for this you can use reverse=True. 

2.reverse: This will reverse the order of the given list.

3. index: This method returns the index of first occurrence of the list item.

4.count: This returns count of number of items with the given value.

5.copy: This returns copy of the list. This can be done to perform operations on the list without modifying the original list.

6. append: This method appends items to the end of existing list.

7. insert: This inserts an item at the given index. user has to specify index and item to be inserted within the insert() method.

8. extend: This adds an entire list or any other collection of datatype to the existing list.

9. concatenating two lists: Simply concatenate two lists to join two lists.

Screenshot of repel:


Link of the repel:

https://replit.com/@shwetaantil97/-List-Methods




Comments

Lusia said…
CODE INFINITY shining like stars 🌟💫✨⭐

Popular posts from this blog