Step 1: match a size
A small flat white is £3.20, a medium costs 40p more and a large 80p more. With if and elif
that's three tests of size == ..., one after another. When every test compares the same variable
with a different value, Python has a neater tool, match:
match size:
case "small":
extra = 0
case "medium":
extra = 40
case "large":
extra = 80
Python compares size with each case from the top and runs the first one that matches. In
sizes.py, work out the extra, then print the price with the size's name:
Large flat white: £4.00
.title() gives size its capital: size.title() is "Large". The check tries all three sizes.
sizes.py, the file you edit7 lines
# Bean There's flat whites by size. Prices and extras in whole pennies.
FLAT_WHITE = 320
size = "large"
# TODO (Step 1): with match, set the extra for the size (small 0, medium 40, large 80) and print:
# Large flat white: £4.00