Recent Posts

List Method


Python has some list methods that you can use to perform frequency occurring task (related to listing) with ease. For example, if you want to add an element to a list, you can use append() method.
The page contains all methods of list objects. Also, the page includes functions that can take list as a parameter and perform some task. For example, all() function returns True if all elements of an list (iterable) is true. If not, it returns False.


These are methods


But maybe you don't want the number to be at the end, so instead of append you use insert
Python List insert()Inserts Element to The List


Python List remove()Removes Element from the List


Python List pop()Removes Element at Given Index


Python List index()returns smallest index of element in list


But there is another way to find a number..with the result of a boolean value ( false or true)

This method doesn't print errors so it's safer to use it
Python List count()returns occurrences of element in a list




Python List sort()sorts elements of a list


Maybe you want to add some information to the list, so probably you want to copy  the list so you start working with either one of them



Write a program to remove duplicates from a list


List Method List Method Reviewed by ohhhvictor on May 07, 2019 Rating: 5

No comments:

Facebook

 photo imagen120.jpg
Theme images by 5ugarless. Powered by Blogger.