Python-da tuple-lary birleşdirmek
Tuple-lary birleşdirmek üçin
+ operator ulanylyp biliner:
tpl1 = ('a', 'b', 'c')
tpl2 = ('d', 'e')
res = tpl1 + tpl2
print(res) # ('a', 'b', 'c', 'd', 'e') çap eder
Üç tuple berlen:
tpl1 = ('1', '2', '3')
tpl2 = ('4', '5', '6')
tpl3 = ('7', '8', '9')
Bu tuple elementlerini bir täze tuple içine birleşdiriň.
Tuple-lar berlen:
tpl1 = (3, 4)
tpl2 = (1, 2)
Şeýle birleşdiriň, şu tuple alyň:
tpl3 = (1, 2, 3, 4)