Before You Begin Exercise — Python Foundations

Optional enrichment — complete during the session if time allows, or finish independently on your fork.

Your Task

Write a script in session_03_exercise.py that:

  1. Defines a list of at least five numeric exam scores.
  2. Writes a function passing_scores(scores, cutoff) that loops over the list and returns a new list containing only the scores at or above cutoff.
  3. Calls the function with a cutoff of 70 and prints the result.
  4. Checks to see if there are any students who got the same score, printing the result.

If you get stuck, re-read the “Putting It Together” section above — it uses the same building blocks in a different combination.

Starter Script

Open session_03_exercise.py and fill in the blanks marked with # TODO:. Every blank is either a string value ("___") or a variable name (___). If you get stuck, the completed version is at session_03_answer.py.

Run from the repo root:

python exercises/session_03_exercise.py