Let's say I have the following lists:
assignment = ['Title', 'Project1', 'Project2', 'Project3']
grades = [ ['Jim', 45, 50, 55], \
['Joe', 55, 50, 45], \
['Pat', 55, 60, 65] ]
I could zip the lists using the following code:
zip(assignment, grades[0], grades[1], grades[2])
How would I use the zip function to zip this if the grades list contains an unkown number of items?
You can use *
to unpack a list into positional parameters:
zip(assignment, *grades)