“Python List Extend ()” Réponses codées

Python List Extend ()

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)
Gorgeous Gazelle

Python List Extend ()

Python Program to extend the list
# Programming list
programming_list = ['C','C#','Python','Java']

frontend_programming =['CSS','HTML','JavaScript']

# add the frontend_progamming list into the existing list
programming_list.extend(frontend_programming)

# Note that iterable element is added to the end of the list
print('The new extended list is :', programming_list)
Gorgeous Gazelle

Réponses similaires à “Python List Extend ()”

Questions similaires à “Python List Extend ()”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code