Converting a Tuple to a List in Python
To make a list from a tuple, you need to apply the list
function:
tpl = ('a', 'b', 'c')
res = list(tpl)
print(res) # ['a', 'b', 'c']
Given a tuple:
tpl = ('2', '6', '12')
Make a list out of it.
The following tuples are given:
tpl1 = ('1', '2', '3')
tpl2 = ('4', '5')
Make the following list from them:
['1', '2', '3', '4', '5']
Given a tuple:
tpl = (1, 2, 3, 4, 5)
Turn it over:
(5, 4, 3, 2, 1)