Problema
Convert a score from 0 to 100 into a letter grade: 90 and above is A, 80–89 is B, 70–79 is C, 60–69 is D, and below 60 is F.
Implement letter_grade(score).
Input
score: The test score.
Output
Return the letter as a one-character string.
Vincoli
0 ≤ score ≤ 100
Esempi
Esempio 1
Input:
score = 85
Output atteso:
expected = "B"
Input:
long long score = 85;
Output atteso:
std::string expected = "B";
Input:
long score = 85;
Output atteso:
string expected = "B";
Spiegazione
85 is at least 80 but below 90, so the grade is B.
Esempio 2
Input:
score = 59
Output atteso:
expected = "F"
Input:
long long score = 59;
Output atteso:
std::string expected = "F";
Input:
long score = 59;
Output atteso:
string expected = "F";
Spiegazione
59 is below 60, so the grade is F.
Riferimenti
Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.