Python List

Lists are one of the most powerful tools in Python. They are just like the arrays declared in other languages. But the most powerful thing is that list need not be always homogeneous. A single list can contain strings, integers, as well as objects. Lists can also be used for implementing stacks and queues. Lists are mutable, i.e., they can be altered once declared.

The output is :

[1, 'a', 'string', 3]
[1, 'a', 'string', 3, 6]
[1, 'a', 'string', 3]

Recent Articles on Python List

Built-in Functions, Programs of List

Built-in Functions

  1. Append(): Add an element to the end of the list
  2. Extend(): Add all elements of a list to the another list
  3. Insert(): Insert an item at the defined index
  4. Remove(): Removes an item from the list
  5. Pop(): Removes and returns an element at the given index
  6. Clear(): Removes all items from the list
  7. Index(): Returns the index of the first matched item
  8. Count(): Returns the count of number of items passed as an argument
  9. Sort(): Sort items in a list in ascending order
  10. Reverse(): Reverse the order of items in the list
  11. Copy(): Returns a shallow copy of the list

Programs of List

More Useful Links

My Personal Notes arrow_drop_up

Recommended Posts: