Curve Exam Scores to 100

Easy ⏱ 8 min 79% acceptance ★★★★★ 4.5
Write curve(scores) scaling a class's exam scores so the top score becomes 100 and everyone rises proportionally (score × 100 / top), rounded to 1 decimal. An empty list returns empty; a top score of 0 returns the list unchanged.

Examples

Example 1
Input
curve([40, 60, 80])
Output
[50.0, 75.0, 100.0]
Explanation

Everything scales by 100/80.

Constraints

  • Proportional scaling, no flat bonus.
  • Guard top == 0.

Topics

Business Logicnormalization

Companies

BYJU'SUnacademyCoursera

Hints

Hint 1

factor = 100 / max(scores).

Hint 2

Comprehension with round(s * factor, 1).

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.