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:
- Defines a list of at least five numeric exam scores.
- Writes a function
passing_scores(scores, cutoff)that loops over the list and returns a new list containing only the scores at or abovecutoff. - Calls the function with a cutoff of
70and prints the result. - 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