1list_of_Lists = [[1,2,3],['hello','world'],[True,False,None]]
2list_of_Lists.append([1,'hello',True])
3ouput = [[1, 2, 3], ['hello', 'world'], [True, False, None], [1, 'hello', True]]
1# Basic syntax:
2your_list.append('element_to_append')
3
4# Example usage:
5your_list = ['a', 'b']
6your_list.append('c')
7print(your_list)
8--> ['a', 'b', 'c']
9
10# Note, .append() changes the list directly and doesn’t require an
11# assignment operation. In fact, the following would produce an error:
12your_list = your_list.append('c')
1 list = ['larry', 'curly', 'moe']
2 list.append('shemp') ## append elem at end
3 list.insert(0, 'xxx') ## insert elem at index 0
4 list.extend(['yyy', 'zzz']) ## add list of elems at end
5 print list ## ['xxx', 'larry', 'curly', 'moe', 'shemp', 'yyy', 'zzz']
6 print list.index('curly') ## 2
7
8 list.remove('curly') ## search and remove that element
9 list.pop(1) ## removes and returns 'larry'
10 print list ## ['xxx', 'moe', 'shemp', 'yyy', 'zzz']
1list_1 = ['w','h']
2list_1.append('y') # you need no veribal to store list_1.append('y')
3print(list_1) # ['w','h','y']
4
5list_2 = ['a','r','e']
6list_1.append(list_2) # This also donot need a veribal to store it
7print(list_1) # ['w','h','y',['a','r','e']]
8
9list_1.extend(list_2)
10print(list_1) # ['w','h','y',['a','r','e'],'a','r','e']
11# please like
1#append to list
2lst = [1, 2, 3]
3li = 4
4lst.append(li)
5#lst is now [1, 2, 3, 4]
6
7.append("the add"): append the object to the end of the list.
8.insert("the add"): inserts the object before the given index.
9.extend("the add"): extends the list by appending elements from the iterable.