Lists
A list is an ordered, mutable collection that can hold different data types.
my_list = [1, 2, 3, "hello", True]List Operationsfruits = ["apple", "mango", "banana"]\nfruits[0] # apple\nfruits.append("orange") # add to end\nfruits.insert(1, "grapes") # insert at pos\nfruits.remove("mango") # remove by value\nfruits.pop() # remove last\nlen(fruits) # lengthList MethodsMethodDescriptionappend(x)Add to endinsert(i,x)Insert at positionremove(x)Remove first xpop()Remove lastsort()Sort listreverse()Reverseindex(x)Index of xcount(x)Count of x