Letter Count Histogram

25-minute lesson · module-lab-letter-histogram

You are previewing this course as a guest

Read anything and run any exercise you like. It all runs in your own browser, so nothing here is saved: no XP, no progress, and the AI tutor needs an account. Sign in and your work starts counting.

Sign in

Letter Count Histogram

25-minute lesson · module-lab-letter-histogram

  • Combine a tally dictionary with sorted iteration to produce ordered output.
  • Build a simple text-based bar chart from numeric data.
  • Sort dictionary keys before iterating to get predictable output order.

Source attribution

Status: adapted

How to Think Like a Computer Scientist: Interactive Edition source · Labs / Letter Count Histogram

Adaptation notes. Original lab paired the dictionary with turtle graphics for bar drawing. We replace turtle with a text-based bar chart so the lesson works in the in-browser Pyodide runtime. Sorting + iteration steps are preserved.

License notes. Original lab is GNU FDL 1.3 (Brad Miller and David Ranum, 2011). No verbatim text from the original is reproduced here.