What it shows
The program stores 12 monthly rainfall values, finds the wettest month and the average, and draws a bar of hash signs for each month. It shows basic data analysis with lists.
The science
Data summaries such as the total, the average and the maximum make a table of numbers easier to understand. The index of the maximum value tells which month was wettest. A text bar chart scales each value, for example 1 hash per 10 mm, so the monsoon peak stands out visually. In India most rain falls from June to September.
Materials
Cost: free. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.
- A computer, laptop or phone with a browser (free)
- Python 3 with IDLE, or the free Thonny editor, or an online Python runner (all free)
- Monthly rainfall in mm for your town from a newspaper, the weather department website or your school’s records
- A notebook and a pencil
Safety
This project uses safe, everyday materials. Still, read the rules below with a parent before you start.
Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.
All the safety rulesStep by step
8 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.
Collect 12 monthly rainfall values for one year from a reliable source and write them in a table with the month names.
Create rain.py and write months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].
Write rain = [ ... ] with your twelve numbers in the same order.
Print total = sum(rain) and the average with round(total / 12, 1).
Find the wettest month with i = rain.index(max(rain)) and print(months[i], max(rain)).
List the months above the average with for m, r in zip(months, rain): and if r > total / 12: print(m).
Draw the chart: for m, r in zip(months, rain): print(f"{m} {'#' * int(r / 10)} {r}").
Compare the chart with the rainfall sheet from a weather source and write two lines about the pattern.
What you should see
The program prints the yearly total, the average, the wettest month and a text chart where the monsoon months show the longest bars.
Viva questions
A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.
1What does max() give?
The largest value in the list.
2How do we find the month of the maximum?
Use index() to get its position, then look up the month name.
3What does zip do?
It pairs up items from two lists.
4Why scale the bars?
A bar of 300 hash signs would not fit on the screen.
Take it further
Read the values from a CSV file for several years and print which year had the highest total.
Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.
Free ebooks for this project
Computer & office
Excel Formulas Workbook
Sixty formulas and functions, each with a worked example from school, shop or office
