Kortežu apvienošana Python

Lai apvienotu kortežus, var izmantot operatoru +:

pythontpl1 = ('a', 'b', 'c')
tpl2 = ('d', 'e')

res = tpl1 + tpl2
print(res) # izvadīs ('a', 'b', 'c', 'd', 'e')
Задание 1

Doti trīs korteži:

pythontpl1 = ('1', '2', '3')
tpl2 = ('4', '5', '6')
tpl3 = ('7', '8', '9')

Apvienojiet šo kortežu elementus vienā jaunā kortežā.

Задание 2

Doti korteži:

pythontpl1 = (3, 4)
tpl2 = (1, 2)

Apvienojiet tos tā, lai iegūtu šādu kortežu:

pythontpl3 = (1, 2, 3, 4)