W WolfCode · CSC 141

Homework: Student Grade Report

作业: 学生成绩报告

≈ 45 min · python-lists python-functions python-loops · Open in WolfCode

Chapter 5 capstone — pulls together lists, loops, conditionals, functions. Five functions, one assembler.

The 5 functions

  • average(scores) — mean; guard for empty
  • highest(scores) — max; guard for empty
  • pass_count(scores, threshold=60) — count passing scores
  • letter_grade(avg) — Ch.2 elif chain
  • report(name, scores) — orchestrator, calls all four

The shape

The orchestrator — see how it composes the helpers

Acceptance criteria

  • All 8 tests pass
  • report calls at least 3 of the 4 helpers
  • average survives empty input
  • All average values rounded to 2 decimals