Jul-21-2017, 02:38 AM
Store it in a dictionary, and increment it every time someone gets a ticket:
tickets['Bob'] += 1A defautldict from the collections module will work well for this, since you won't have to initialize it for new staff. Then:
ticket_counts = [(count, name) for name, count in tickets.items()] ticket_counts.sort() print(ticket_counts[0][1])That will get you the name of the person with the least tickets. Technically it will give you the person with the first name alphabetically of those with the lowest ticket count. You could use
print(ticket_counts[:3])
to see the top three if you wanted.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures