Multiplying Tuples in Python
We can also multiply tuples, i.e. copy them a certain number of times. This is done using the operator *:
tpl = ('a', 'b')
res = tpl * 2
print(res) # ('a', 'b', 'a', 'b')
A tuple is given:
tpl1 = ('1', '2', '3')
Create the following tuple from it:
tpl2 = ('1', '2', '3', '1', '2', '3', '1', '2', '3')
The following tuples are given:
tpl1 = ('a', 'b')
tpl2 = (1, 2)
Write code to get the following tuple:
tpl3 = ('a', 'b', 'a', 'b', 1, 2)