Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add Elements to Python list Using extend() 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 multiple elements
# to the List at the end
# (using Extend Method)
List.extend([8, 'Softhunt', 'Tutorials'])
print("
List after performing Extend Operation: ")
print(List)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #add #Elements #Python #list #Using #method
ADD COMMENT
Topic
Name
5+1 =