← The arcade

Machines · difficulty 2 of 3

Supermarket checkout 🛒

Total a basket with offers: apples are 3 for the price of 2, and bread is buy one get one free. Print each line as name x qty £total then the grand total.

Write it in the browser and press run. Real Python, checked against the expected output, no account needed.

Skills: dicts, if/else, loops

Open the arcade