Answered by : charlesalexandre-roy
# Basic syntax:
first_list.append(second_list) # Append adds the second_list as an
# element to the first_list
first_list.extend(second_list) # Extend combines the elements of the
# first_list and the second_list
# Note, both append and extend modify the first_list in place
# Example usage for append:
first_list = [1, 2, 3, 4, 5]
second_list = [6, 7, 8, 9]
first_list.append(second_list)
print(first_list)
--> [1, 2, 3, 4, 5, [6, 7, 8, 9]]
# Example usage for extend:
first_list = [1, 2, 3, 4, 5]
second_list = [6, 7, 8, 9]
first_list.extend(second_list)
print(first_list)
--> [1, 2, 3, 4, 5, 6, 7, 8, 9]
Source : https://www.kite.com/python/answers/how-to-append-one-list-to-another-list-in-python | Last Update : Sun, 11 Oct 20
Answered by : harit-rai
# plz suscribe to my youtube channel -->
# https://www.youtube.com/channel/UC-sfqidn2fKZslHWnm5qe-A
#append items to list
list_example = ["python","ruby","java","javascript","c#","css","html"]
print(list_example)
list_example.append("assembly")
print(list_example)
#output
['python', 'ruby', 'java', 'javascript', 'c#', 'css', 'html']
['python', 'ruby', 'java', 'javascript', 'c#', 'css', 'html', 'assembly']
Source : | Last Update : Thu, 30 Dec 21
Answered by : sore-snake-71e46pri6p5v
numbers = [5, 10, 15]
numbers.append(20)
Source : | Last Update : Wed, 08 Dec 21
Answered by : important-iguana-9ozf055wwi4o
currencies = ['Dollar', 'Euro', 'Pound']
# append 'Yen' to the list
currencies.append('Yen')
print(currencies)
# Output: ['Dollar', 'Euro', 'Pound', 'Yen']
Source : https://www.programiz.com/python-programming/methods/list/append | Last Update : Mon, 11 Apr 22
Answered by : samer-saeid
thislist = ["apple", "banana", "cherry"]
thislist.append("orange")
print(thislist)
Source : | Last Update : Sun, 07 Mar 21
Answered by : hanke-hu
list.append(element)
Source : | Last Update : Wed, 03 Aug 22
Answered by : flashingmustard
lst = ["f", "o", "o", "b", "a","r"]
lst.append("b")
print(lst) # ["f", "o", "o", "b", "a", "r", "b"]
Source : | Last Update : Fri, 19 Nov 21
Answered by : dubas-sumit
listA = [] for a in range(50): if a%5==0: listA.append(a)
Source : https://www.codewithharry.com/videos/python-tutorials-for-absolute-beginners-73/ | Last Update : Sun, 31 Jul 22
Answered by : evil-elephant-ndgzc6qot1k2
myList = [1, 2, 3]
Source : | Last Update : Mon, 17 Jan 22