In this activity, we will build a Grade Calculator in Python. The program will ask for a student's score and use conditional statements to determine and display their letter grade.

Grading Criteria

Writing the Script
# Grade Calculator def get_grade(score): if score >= 90: return "A" elif score >= 80: return "B" elif score >= 70: return "C" elif score >= 60: return "D" else: return "F" # Main program name = input("Enter student name: ") score = float(input("Enter score: ")) if score < 0 or score > 100: print("Invalid score. Please enter a value between 0 and 100.") else: grade = get_grade(score) print(name + " scored " + str(score) + " and received Grade: " + grade)
Testing the Program
- Run with name = Ali, score = 92 → Grade: A
- Run with name = Sara, score = 76 → Grade: C
- Run with name = Zara, score = 55 → Grade: F
- Run with score = 105 → Should display invalid score message


.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)