This repository contains two implementations of a Grade Checker program in Python:
- Single File Version - All functions in one file
- Modular Version - Code organized into separate modules
File: grade_checker_single_file.py
This version contains all functions in a single Python file with clear separation of concerns.
- Input validation for student count and grades
- Conversion of numeric grades to letter grades (A-F)
- GPA calculation (4.0 scale)
- Class average and GPA statistics
- Formatted output table
python grade_checker_single_file.pyget_student_count()- Gets number of studentsget_student_info()- Gets individual student name and gradeget_all_students()- Collects all student dataconvert_to_letter_grade()- Converts numeric to letter gradecalculate_gpa_points()- Converts letter grade to GPA pointsprocess_grades()- Processes all gradescalculate_class_average()- Calculates class averagecalculate_class_gpa()- Calculates class GPAdisplay_student_results()- Displays formatted resultsdisplay_class_statistics()- Shows class statisticsmain()- Main program flow
This version separates the program into four focused modules:
Files:
grade_checker_main.py- Main module (orchestrator)grade_checker_input.py- Input modulegrade_checker_logic.py- Logic/calculation modulegrade_checker_output.py- Output/display module
Handles all user input:
get_student_count()- Validates student countget_student_info()- Gets student name and gradeget_all_students()- Collects all student data
Handles all calculations and processing:
convert_to_letter_grade()- Grade conversioncalculate_gpa_points()- GPA conversionprocess_grades()- Process all gradescalculate_class_average()- Class averagecalculate_class_gpa()- Class GPA
Handles all display and formatting:
display_student_results()- Results tabledisplay_class_statistics()- Statistics displaydisplay_welcome_message()- Welcome messagedisplay_goodbye_message()- Goodbye messagedisplay_no_students_message()- No students message
Orchestrates the program:
main()- Imports and coordinates all modules
python grade_checker_main.pyNote: When running the modular version, ensure all four module files are in the same directory.
| Letter Grade | Numeric Range | GPA Points |
|---|---|---|
| A | 90-100 | 4.0 |
| B | 80-89 | 3.0 |
| C | 70-79 | 2.0 |
| D | 60-69 | 1.0 |
| F | 0-59 | 0.0 |
Welcome to the Grade Checker Program!
----------------------------------------
How many students do you want to grade? 3
Enter name for student 1: Alice
Enter grade for Alice (0-100): 92
Enter name for student 2: Bob
Enter grade for Bob (0-100): 78
Enter name for student 3: Charlie
Enter grade for Charlie (0-100): 85
======================================================================
Student Name Numeric Grade Letter Grade GPA Points
======================================================================
Alice 92.00 A 4.00
Bob 78.00 C 2.00
Charlie 85.00 B 3.00
======================================================================
Class Statistics:
----------------------------------------
Class Average Grade: 85.00
Class Average GPA: 3.00
----------------------------------------
Thank you for using the Grade Checker Program!
| Aspect | Single File | Modular |
|---|---|---|
| Complexity | Simple, all-in-one | Organized, separated concerns |
| Reusability | Functions can be imported | Modules can be reused independently |
| Testing | Easier for small programs | Easier for large programs |
| Maintainability | Suitable for learning | Better for larger projects |
| Scalability | Limited | Highly scalable |
- Python 3.6+
- No external libraries required
Created as a classwork assignment to demonstrate function organization and modular programming principles in Python.