I have a variable that holds lists
s=[16, 29, 16]
[16, 16, 16]
I want to combine them like this
combined = [16,16]
[29,16]
[16,16]
I have a variable that holds lists
s=[16, 29, 16]
[16, 16, 16]
I want to combine them like this
combined = [16,16]
[29,16]
[16,16]
Use zip function, like this
s = [[16, 29, 16], [16, 16, 16]]
print zip(*s)
# [(16, 16), (29, 16), (16, 16)]
If you want the output to be a list of lists, then you can simply do
print map(list, zip(*s))
# [[16, 16], [29, 16], [16, 16]]
score is defined