Money Β· percentages
Bag a bargain!
π School maths Β· Years 5β7Percentages β Find a percentage of an amount (a discount) and work out the new price.Maths by year β
The Case. The trainers you want are Β£40 β but there's 25% off! What do you actually pay? Working out discounts is money maths you'll use your whole life.
Your tools. numpy does the percentage sums on every item at once; matplotlib shows what you save.
Investigate. Press Run. Each item shows its full price and the sale price β plus your total saving.
- Change the discounts and watch your savings grow.
- This is exactly the maths behind every shop's sale.
your_code.py
Starting Pythonβ¦
The Reveal
Starting Pythonβ¦ (first time only β a few seconds)
ποΈ Detective's notes
Bundles your findings, chart and code into one PDF you can keep, print or hand in.
π§© How this code works
The tools it uses
- NumPy β a row of boxes that holds numbers, so you can do maths to all of them at once.
- Matplotlib β your crayon box β it turns numbers into charts and pictures.
What this one does
- β’ It draws a bar chart β great for comparing amounts.
How to read it, top to bottom
- 1. Import β bring in the tools (listed above).
- 2. The data β the lists and numbers near the top. These are the bits you change.
- 3. The work β a little maths, or a loop that repeats a step.
- 4. Show it β
print(...)writes words;plt.show()draws the picture.
Use it for your own problems
- Change the numbers at the top and press Run β nothing breaks, so experiment!
- Ask your own version of the question β swap in your family, your scores, your week.
- The same tools work on any numbers β that's the superpower you're learning.
Need a hint?
25% off means you pay 75% β that's price * (1 - 25/100). Percentages are just parts out of 100.