Answers for "python insert element into list"

0

add an element to list python

a=[8,5,6,1,7]
a.append(9)
Posted by: Guest on May-31-2020
0

insert an element in list python

>>> a = [1, 2, 4]
>>> print a
[1, 2, 4]

>>> print a.insert(2, 3)
None

>>> print a
[1, 2, 3, 4]

>>> b = a.insert(3, 6)
>>> print b
None

>>> print a
[1, 2, 3, 6, 4]
Posted by: Guest on June-20-2021

Code answers related to "python insert element into list"

Python Answers by Framework

Browse Popular Code Answers by Language