The letter grade
- O(1) · Trivial
- Free
- Python
- JavaScript
- conditionals
- strings
- comparisons
Problem
The school hands out grades as letters: 90 and up is "A", 80 to 89 is "B", 70 to 79 is "C", 60 to 69 is "D", and under 60 is "F". Return the letter that score earns.
Every line belongs to the group above it: 90 is an "A" and 89 is a "B".
Examples
95 → "A"
83 → "B"
71 → "C"
Failing
42 → "F"
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def letter(score):
passJavaScript
function letter(score) {
}Solve this challenge
It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.