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.
More O(1) challenges
- The letters left overPython · JavaScript · strings · operations
- The middle letterPython · JavaScript · strings · indexes
- The name, written rightPython · JavaScript · strings
- The nearest tenPython · JavaScript · operations · division
- The percentage you got rightPython · JavaScript · operations · division · decimals
- The seats still freePython · JavaScript · operations · division