Computer Science I / Integrated Introductory Programming Practice
Practice question · Put in order

Order the structured approach to the task: read a list of exam scores and report how many passed and the class average.

Hints
  1. Modelling the data comes before sketching the algorithm that operates on it.
  2. Edge-case handling and testing come after the core logic is packaged.
Show the answer
  1. Model the data: the scores are a list of numbers
  2. Sketch the algorithm in pseudocode, looping over the scores
  3. Package the repeated logic in a function such as average(scores)
  4. Handle the edge cases, such as an empty list
  5. Test with typical, empty, all-passing, and boundary inputs
Why

Model the data, sketch the algorithm, package it in a function, guard the edge cases, then test. This is the shape of nearly all beginner programming, the concepts are assembled in this order, not applied one isolated trick at a time.

Read the lesson: Integrated Introductory Programming Practice →

Practise Integrated Introductory Programming Practice

The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Integrated Introductory Programming Practice