Q:

How many integers exist after the first string in a list of tuples

So I'm learning to work with python and I'm having trouble working with a list of tuples. I'm trying to count the number of integers in each tuple after the name of each one.
ex. [('bagels',4,3,2,1), ('pies',6,5,4,2), ('cakes',12,11,10,0)]
My goal is to be able to save the names of each tuple then count the number of integers after them. I need the number of integers because I have to take into account multiple people wanting treats. 
My end goal would be something like. ex. cakes:12 pies:6 if i printed the 2 highest valued treats. What should I do to skip over the strings?

A:

Use a dict comprehension:
r = {v[0] : max(v[1:] for v in data}

print(r)
{'bagels': 4, 'cakes': 12, 'pies': 6}

This is equivalent to the following:
r = {} # declare a dict
for v in data:
    i = v[0]        # find the item name
    j = max(v[1:])  # find the max of all integers following the item

    r[i] = j     # add an entry into the dictionary

Details

A dict comprehension is a concise way of representing a for loop in python.
v[0] retrieves the 0th element, and is assigned the key 
`max(v[1:]) finds the max of the integers following the item 

At the end, if you want to display the result r, you can iterate over the it:
for k, v in r.items():
    print('{}:{}'.format(k, v))

cakes:12
bagels:4
pies:6

Note here, that dictionaries are not ordered, so you are not likely to print results in the same order as you input entries. In this case, you could consider using a list:
r = ['{}:{}'.format(v[0], max(v[1:])) for v in data]

print(r)
['bagels:4', 'pies:6', 'cakes:12']

Printing follows in a similar fashion. Call sorted with reversed=True if you want to print values from highest to lowest.
for i in sorted(r, reverse=True):
    print(i)

cakes:12
pies:6
bagels:4

