Learn
Exam

Determine Grade

Difficulty
STARTER

Problem

Given a score score, write a function solution that returns a grade based on the following criteria:

  • 90 or above: A
  • 80 to 89: B
  • 70 to 79: C
  • 60 to 69: D
  • Below 60: F

Constraints

  • score is an integer between 0 and 100 inclusive.

Test Case

Test Case Number score return
1 95 "A"
2 82 "B"
3 45 "F"

Explanation for Test Case 1

  • When score = 95, it is 90 or above, so return A.

Explanation for Test Case 2

  • When score = 82, it is between 80 and 89, so return B.

Explanation for Test Case 3

  • When score = 45, it is below 60, so return F.