Part 3 · Section 04

Coding Exercises

Time to practice. These four problems are small, but each one rewards knowing the dictionary toolkit well: building dicts from iterables of pairs, using keys views as sets, merging counts from several sources, and keeping (or deliberately choosing) the order of the result. Try to write each solution the Pythonic way, with comprehensions, views and built-ins rather than an empty dict filled in one key at a time.

You’ll practice:

Lectures

  1. 01Coding Exercises✓
  2. 02Coding Exercises - Solution 1✓
  3. 03Coding Exercises - Solution 2✓
  4. 04Coding Exercises - Solution 3✓
  5. 05Coding Exercises - Solution 4✓

Practice: quiz & exercises

7 quiz questions · 4 coding exercises

Go to practice →