append multiple elements to list python condition code example

Example 1: append multiple strings to list python

>>> lst = [1, 2]
>>> lst.append(3)
>>> lst.append(4)
>>> lst
[1, 2, 3, 4]

>>> lst.extend([5, 6, 7])
>>> lst.extend((8, 9, 10))
>>> lst
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

>>> lst.extend(range(11, 14))
>>> lst
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

Example 2: python append multiple values

list.extend(val1,val2,val3....)
list.extend( [val1,val2],val3,val4,[val5,val6,val7])
#any combination of integers, strings, lists and tuples works