Answers for "apend at start of list pthon"

41

python append to start of list

lst = ["f", "o", "o", "b", "a","r"]
lst.insert(0,"b")
print(lst) # ["b", "f", "o", "o", "b", "a", "r"]
Posted by: Guest on December-09-2021
0

add a value to the start of a list python

>>>var=7
>>>array = [1,2,3,4,5,6]
>>>array.insert(0,var)
>>>array
[7, 1, 2, 3, 4, 5, 6]
Posted by: Guest on December-02-2019

Python Answers by Framework

Browse Popular Code Answers by Language