
Checkpoint
Checkpoint: The Lantern Shop
The Lantern Shop on Emberreach needs a new till. Customers buy small or large lanterns, plus some oil to fill them. The shopkeeper wants a program that works out every bill.
This checkpoint uses the whole chapter: parameters,
return, and small helper functions that call each other.
Assignment
lantern_price(size)returns8ifsizeis"large", otherwise5.order_total(size, count, oil)returns the price ofcountlanterns of that size, plus2coins for each litre ofoil. It must calllantern_price.receipt(name, size, count, oil)returns (not prints) a string like"Ada pays 26 coins". It must useorder_total.
For example, Ada buys 2 large lanterns and 5 litres of oil:
2 * 8 + 5 * 2 is 26.
lantern_price(size)returns8ifsizeis"large", otherwise5.order_total(size, count, oil)returns the price ofcountlanterns of that size, plus2coins for each litre ofoil. It must calllantern_price.receipt(name, size, count, oil)returns (not prints) a string like"Ada pays 26 coins". It must useorder_total.
For example, Ada buys 2 large lanterns and 5 litres of oil:
2 * 8 + 5 * 2 is 26.
main.py Python sleeping
Press Run to try your code, then Check to test it.