Adding an item to the beginning of a Python list


There is an append () function, but it adds an item to the end of the list, which function should I use to add it to the beginning? for instance

Добавить 5 в начало 


l = [10,100,55]

Option 1:

l.insert(0, 5)

Option 2:

l = [5] + l
Scroll to Top