Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Difference between append() and extend() method in Python

Difference between List append() and List extend() method
a =[1,2]
b= [3,4]

# append() method 
a.append(b)
print("Using append() method", a)

x =[1,2]
y= [3,4]


# extend() method 
x.extend(y)
print("Using extend() method", x)
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #Difference #method #Python
ADD COMMENT
Topic
Name
7+7 =