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.

# Declaring and printing list
L = [1, "a" , "string" , 1+2]

# Adding more items

# Removing an item


# Printing a particular item

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

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Recommended Posts:

0 Average Difficulty : 0/5.0
No votes yet.