Python-da tuple-dan list döretmek
Tuple-dan list döretmek üçin,
list funksiýasyny ulanyň:
tpl = ('a', 'b', 'c')
res = list(tpl)
print(res) # ['a', 'b', 'c'] çykaryar
Tuple berlen:
tpl = ('2', '6', '12')
Ondan bir list dörediň.
Tuple-lar berlen:
tpl1 = ('1', '2', '3')
tpl2 = ('4', '5')
Olardan şu list-i dörediň:
['1', '2', '3', '4', '5']
Tuple berlen:
tpl = (1, 2, 3, 4, 5)
Ony tersine öwüriň:
(5, 4, 3, 2, 1)