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