HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A school weather station records the rain each day, in millimetres…
EasyComputer ScienceHigh School (9–10)Computer Science › Algorithms and Problem-SolvingNumericalIGCSE

A school weather station records the rain each day, in millimetres…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A school weather station records the rain each day, in millimetres. One week the readings, Monday to Sunday, are 000, 444, 121212, 000, 000, 777 and 555. This algorithm processes them.

pseudocode
Total ← 0
Dry ← 0
FOR Day ← 1 TO 7
    INPUT Rain
    Total ← Total + Rain
    IF Rain = 0
      THEN
        Dry ← Dry + 1
    ENDIF
NEXT Day
OUTPUT Total, " ", Dry, " ", Total / 7

Find the three values it outputs: the total rain, the number of dry days and the average rain per day.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

Totalling: Total ← 0 before the loop, Total ← Total + Value inside. Counting: Count ← 0 before, Count ← Count + 1 inside (often in an IF). Maximum and minimum: start with the first value or an extreme value, and replace it with any larger (or smaller) value. Average: Total / Count after the loop.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. Total. 0+4+12+0+0+7+5=280 + 4 + 12 + 0 + 0 + 7 + 5 = 280+4+12+0+0+7+5=28 millimetres.

Step 2. Count. The dry days are Monday, Thursday and Friday: 333 days.

Step 3. Average. 28÷7=428 \div 7 = 428÷7=4 millimetres a day.

Answer: the output is 28 3 4.

Check. A dry day still counts as a day when finding the average, so we divide by 777, not by 444.

Log in to save this for later
← All Problems
← A swimming pool gives a teen ticket to anyone aged from 13 to 19, both included…A freezer records four temperatures in degrees Celsius: -3, -8, -1 and -6… →
More onComputer Science › Algorithms and Problem-Solving

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Totalling, counting, maximum, minimum and averageStandard Algorithms: Totals, Searching, Sorting and Validation

More on this topic

  1. This is the kind of long scenario question that ends Paper 2…Hard
  2. A delivery company adds a check digit to each parcel number…Medium
  3. Name the check in each case. Say whether it is validation or verification…Easy
A bubble sort is changed so that it sorts in descending order: the comparison becomes IF…Hard
  • A shop stores the colours of the ten bicycles in its window in an array Colours: red, blue, red…Medium
  • All problems on this topic →