log = [("career fair", 3), ("job shadowing", 6), ("coding club", 10),
("volunteering", 12), ("coding club", 8), ("competition", 3)]
totals = {}
for activity, hours in log:
totals[activity] = totals.get(activity, 0) + hours
for activity in sorted(totals):
print(activity + ":", totals[activity], "h")
print("Total:", sum(totals.values()), "h")
An experience log. Keeping track helps when you write a résumé or apply to programs. Output (one line each): career fair: 3 h / coding club: 18 h / competition: 3 h / job shadowing: 6 h / volunteering: 12 h / Total: 42 h