The final grade
- O(1) · Trivial
- Free
- Python
- JavaScript
- operations
- decimals
Problem
The final grade comes from two parts: the exam is worth weight percent, and your class work is worth whatever is left to reach 100. With an exam of 72, work of 88 and a weight of 70, the final is 76.8. Return the final grade rounded to the nearest whole number, so that case returns 77. weight can be 0, and then the exam counts for nothing.
Examples
72, 88, 70 → 77
No decimals
80, 95, 60 → 86
Rounds down
81, 60, 40 → 68
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def grade(exam, work, weight):
passJavaScript
function grade(exam, work, weight) {
}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.