Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add Elements to Python list Using insert() method

# Python program to demonstrate
# Addition of elements in a List
  
# Creating a List
List = [1,2,3,4]
print("Initial List: ")
print(List)
 
# Addition of Element at
# specific Position
# (using Insert Method)
List.insert(0, 0)
List.insert(5, 'Softhunt.net')
print("
List after performing Insert Operation: ")
print(List)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #add #Elements #Python #list #Using #method
ADD COMMENT
Topic
Name
2+1 =