Lecture
Coding Quiz - Determine Grade Using Conditional Statements
In this coding quiz, you will write a function that determines a grade based on a given score.
You will receive a score (integer) from the user and return the corresponding grade.
Grades are assigned based on the following criteria:
-
90 and above: 'A'
-
80 to 89: 'B'
-
70 to 79: 'C'
-
60 to 69: 'D'
-
Below 60: 'F'
Code Implementation
def solution(score): # Write your code here return
Constraints
- The score received as input will be an integer between 0 and 100 inclusive.
Example Input and Output
-
Input:
95 -
Output:
A
-
Input:
75 -
Output:
C
Previous lessonCreate Dictionary from Key/Value Pairs - SolutionNext lessonCalculating Grades with Conditional Statements - Solution
Lessons in this chapter · Introduction to Python Algorithms
- 1. Why You Need to Learn Algorithms?
- 2. Review of Algorithm Complexity Concepts
- 3. Life is Practical! Algorithm Problem Solving
- 4. Coding Quiz - Reverse String
- 5. String Reversal - Solution
- 6. Coding Quiz - String Case Conversion
- 7. String Case Alteration - Solution Explanation
- 8. Coding Quiz - Create a List of Powers of 2
- 9. Creating a Power of Two List - Solution Guide
- 10. Coding Quiz - Sorting Tuples by Score
- 11. Sort Tuples by Score - Solution
- 12. Coding Quiz - Find Union and Intersection
- 13. Calculating Union and Intersection - Problem Solution
- 14. Coding Quiz - Create a Dictionary from Key/Value Pairs
- 15. Create Dictionary from Key/Value Pairs - Solution
- 16. Coding Quiz - Determine Grade Using Conditional Statements
- 17. Calculating Grades with Conditional Statements - Solution
- 18. Coding Quiz - Diagonal Traverse of 2D Array
- 19. Diagonal Traversal of a 2D Array - Problem Solution
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help