Calculating Grades with Conditional Statements - Solution
Check out 3 ways to calculate grades using conditional statements.
Sample Solution
def solution(score): if score >= 90: return 'A' elif score >= 80: return 'B' elif score >= 70: return 'C' elif score >= 60: return 'D' else: return 'F'
By using the code above, you can return the grade based on the given score.
Example Usage
Input/Output Example
score = 85 grade = solution(score) print(grade) # Output: 'B'
Lecture
AI Tutor
Publish
Design
Upload
Notes
Favorites
Help