Build a Grade Calculator with Classes (OOP Version)
Level: Beginner
Last week we built a grade calculator using functions (see the original project here: https://dailypythonprojects.substack.com/p/build-a-grade-calculator-with-functions). This week, we’re taking it to the next level by rebuilding the same project using Object-Oriented Programming with classes! You’ll learn how to organize your code into a class structure, making it more scalable and reusable.
Original Function-Based Script:
# Print header
print("Grade Calculator")
print("================\n")
# Function to calculate average score
# (takes a list of scores, returns the average)
def calculate_average(scores):
average = sum(scores) / len(scores)
return average
# Function to convert numeric score to letter grade
# (takes a score number, returns letter A-F)
def get_letter_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"
# Function to determine pass/fail status
# (takes a score, returns "PASS" or "FAIL")
def get_status(score):
if score >= 60:
return "PASS"
else:
return "FAIL"
# Function to generate the complete report
# (takes name and scores, calls other functions, prints report)
def generate_report(name, scores):
# Calculate average using the calculate_average function
average = calculate_average(scores)
# Get letter grade using the get_letter_grade function
letter_grade = get_letter_grade(average)
# Get pass/fail status using the get_status function
status = get_status(average)
# Print the report
print("\nStudent Grade Report")
print("====================")
print(f"Name: {name}\n")
print(f"Test Scores: {', '.join(map(str, scores))}")
print(f"Average Score: {average:.1f}")
print(f"Letter Grade: {letter_grade}")
print(f"Status: {status}\n")
# Get user input
# (student name)
name = input("Enter student name: ")
# Get test scores
# (comma-separated string, convert to list of integers)
scores_input = input("\nEnter test scores (comma-separated): ")
scores = [int(score.strip()) for score in scores_input.split(',')]
# Print processing message
print("\nProcessing grades...")
# Generate the report
# (call the generate_report function)
generate_report(name, scores)
# Print completion message
print("Report generated successfully!")
Project Task
Create a grade calculator using classes that:
Uses a Student class to represent a student with name and scores
Stores student data as class attributes
Implements methods for calculating average, letter grade, and status
Uses the init method to initialize student data
Demonstrates encapsulation by keeping data and methods together
Shows how classes create objects that maintain their own state
Generates the same report output but with OOP structure
This project gives you hands-on practice with class creation, instance methods, the init constructor, and Object-Oriented Programming principles — essential skills for writing professional, maintainable code.
Expected Output
Here is how the script runs. The text in red is input entered by the user:
Join the Python & AI Builders Skool Community
Got questions to ask the author about this project? Join our Python & AI Builders community for weekly Python & AI videos and discussions:
https://skool.com/automateit
Skeleton and Solution
Below you will find both a downloadable skeleton.py file to help you code the project with comment guides and the downloadable solution.py file containing the correct solution.
Get the code skeleton here:
Get the code solution here:



