Challenge: Improving the Grade Categorizer
Task
Swipe to start coding
In a previous task, you wrote a program that calculated a student's grade based on their score. Now imagine you need to calculate grades for many students. To make this reusable, you'll convert the logic into a function.
Your tasks:
- Define a function called
getGradewith one parameter namedgrade. - Move the given grading logic inside the function.
- Instead of printing the result, return the grade message.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 7
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 1.35
Challenge: Improving the Grade Categorizer
Swipe to show menu
Task
Swipe to start coding
In a previous task, you wrote a program that calculated a student's grade based on their score. Now imagine you need to calculate grades for many students. To make this reusable, you'll convert the logic into a function.
Your tasks:
- Define a function called
getGradewith one parameter namedgrade. - Move the given grading logic inside the function.
- Instead of printing the result, return the grade message.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 7
single