and append lsit of lists code example
Example 1: extend a list python
#adding two or more elements in a list
list1 = [1,2,3,4,5]
list1.extend([6,7,8])
print(list1)
#output = [1, 2, 3 ,4 ,5, 6, 7, 8]
Example 2: how can I add all the element of list of word in python?
l = ['aaa', 'bbb', 'ccc']
s = ''.join(l)
print(s)
# aaabbbccc
s = ','.join(l)
print(s)
# aaa,bbb,ccc
s = '-'.join(l)
print(s)
# aaa-bbb-ccc
s = '\n'.join(l)
print(s)
# aaa
# bbb
# ccc