I have a function that returns three lists into a tuple with three lists,
def dealList(list):
a, b, c = (list[::3]), list[1::3], list[2::3]
#here im just taking the first seven elements in the list
a = a[0:7]
b = b[0:7]
c = c[0:7]
sortedarrangement=(a,b,c)
return sortedarrangement
this function in a sample would return "(['D6', 'HJ', 'H7', 'H9', 'H8', 'S10', 'C2'], ['D9', 'D3', 'DQ', 'S9', 'C6', 'C4', 'D7'], ['S4', 'CJ', 'H5', 'H3', 'C5', 'CQ', 'H6'])"
however i would like to use this tuple in another function which argues if a parameter = 1 for example reorder sortedarrangement as b,a,c for example and then print it out as a list of elements with this new order rather than a tuple, i understand tuples are immutable making this quite a difficult task. Any thoughts?
def reorder(sortedarrangement , inputcolumn):
s = dealList(list)
a,b,c = s
#cardcolumn calls an input function
card_column = input()
if card_column == 1:
l = b,a,c
print(l)
elif card_column == 2:
l = a,b,c
print(l)
elif card_column == 3:
l = a,c,b
print(l)
return l ['D9', 'D3', 'DQ', 'S9', 'C6', 'C4', 'D7']
L at the moment returns
(['D9', 'D3', 'DQ', 'S9', 'C6', 'C4', 'D7'], ['D6', 'HJ', 'H7', 'H9', 'H8', 'S10', 'C2'], ['S4', 'CJ', 'H5', 'H3', 'C5', 'CQ', 'H6'])
here i would like to essentially return a list of the elements in the order of the "L" variable and then be able to put "L" into the deal list function and repeat the process.
The end goal is for a list that returns
['D9', 'D3', 'DQ', 'S9', 'C6', 'C4', 'D7','D6','HJ', 'H7', 'H9', 'H8', 'S10','C2''S4', 'CJ', 'H5', 'H3', 'C5', 'CQ', 'H6']
in its new order
Many thanks