Course of Raku / Addendum 🆕 / Bringing it together / Mixed mini-projects / Exercises

A text histogram

Problem

Given sales figures apples => 5, pears => 3, plums => 8, print a simple bar chart: each label followed by a bar of # characters as long as its value, ordered by label.

Example

The program prints:

apples: #####
pears: ###
plums: ########

Solution

See the solution

Course navigation

Solution: A reverse-Polish calculator   |   Solution: A text histogram