I have got two lists like this:
t = [1,2,3,4]
f = ['apples', 'oranges','grapes','pears']
I need to create a list of lists like this:
data = [
['Fruit', 'Total'],
['apples', 1],
['oranges', 2],
['grapes', 3],
['pears' 4]
]
I have done this:
l = []
l.append(['Fruit', 'Total'])
# I guess I should have check that lists are the same size?
for i, fruit in enumerate(f):
l.append([fruit, t[i]])
Just wondering if there is a more Pythonic way of doing this.