LIST in Python

About LIST

  • Lists are used to store multiple items in a single variable.

L= ["mango", "guava", "banana", "apple", "cherry"]
print(L)

  • List items are ordered, changeable, and allow duplicate values.
  • List items are indexed, the first item has index [0], the second item has index [1] and last item has index [n-1] , where n is the no. of elements in list.
  • The list is changeable, meaning that we can change, add, and remove items in a list after it has been created.
  • List items can be of any data type ( numeric, alphabetical , alphanumeric etc.).

L1 = ["apple", "banana", "cherry"]
L2 = [1, 5, 5, 17, 9, 3]
L3 = [True, False, False]
L4 = ["abc"34True40"male"]

 

Leave a Reply

Your email address will not be published. Required fields are marked *