“Python List Extend ()” Code-Antworten

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

Ähnliche Antworten wie “Python List Extend ()”

Fragen ähnlich wie “Python List Extend ()”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen