challenges_done = [('mike', 10), ('julian', 7), ('bob', 5),
('mike', 11), ('julian', 8), ('bob', 6)]
challenges = defaultdict(list)
for name, challenge in challenges_done:
challenges[name].append(challenge)
challenges
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter