add to first element list python code example
Example 1: python list add first
# list.insert(before, value)
list = ["a", "b"]
list.insert(0, "c")
print(list) # ['c', 'a', 'b']
Example 2: append first to list pythno
array.insert(0,var)
# list.insert(before, value)
list = ["a", "b"]
list.insert(0, "c")
print(list) # ['c', 'a', 'b']
array.insert(0,var)