Editor

Counting Class Votes

Rearrange the lines · Intermediate · about 6 min

A class votes for the color of its sports day T-shirts. This program counts the votes in a dictionary, then prints each color with its count, in the order the colors first appear. Its lines are mixed up: put them back in an order that prints exactly the output below. Each block keeps its indentation, so you only choose the order.

Example

In the right order, the program prints:

red 3
blue 2
green 1

Your program

0 of 7 placed

Add the first line from the blocks.

Blocks

7 blocks still to place
The solution opens after your first Check.