Skip to content
Exercise · Conditions · lesson 7 of 8

Exercise: letter grade

Write a function grade(score) that turns a score into a grade. It returns:

  • "A" for 90 points or more;
  • "B" for 75–89 points;
  • "C" for 60–74 points;
  • "F" for fewer than 60 points.

Examples:

  • grade(90) → "A"
  • grade(74) → "C"
  • grade(59) → "F"

Constraints: score is an integer from 0 to 100 inclusive.

Do not add extra imports unless the task says so explicitly.

grade.py — python
python · 3 lines
Ctrl+Enter run · Esc leave editor

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way