Kubadilisha Tuple kuwa Orodha katika Python
Ili kufanya tuple kuwa orodha, ni lazima
utumie kitendakazi list:
tpl = ('a', 'b', 'c')
res = list(tpl)
print(res) # itatolea ['a', 'b', 'c']
Imetolewa tuple:
tpl = ('2', '6', '12')
Fanyeni kuwa orodha.
Yametolewa matuple:
tpl1 = ('1', '2', '3')
tpl2 = ('4', '5')
Fanyeni yakuwe orodha ifuatayo:
['1', '2', '3', '4', '5']
Imetolewa tuple:
tpl = (1, 2, 3, 4, 5)
Tupeleke upande wa pili:
(5, 4, 3, 2, 1)