Appending to a List in Python
We can also combine two lists, changing the original one. In such cases, we use the operator +=:
lst1 = [1, 2, 3]
lst2 = [4, 5, 6]
lst1 += lst2
print(lst1) # [1, 2, 3, 4, 5, 6]
Two lists are given:
lst1 = ['12', '34', '56']
lst2 = ['ab', 'cd', 'ef']
Combine them.
Two lists are given:
lst1 = ['a', 'b', 'c']
lst2 = [4, 5, 6]
Add the first list to the second.