Python implementation
Student Grade Calculator in Python
Build a console application that calculates totals, averages, grades, and pass or fail results.
Setup instructions
This project is built using modern Python 3.10+ and standard libraries.
1. Ensure you have Python 3.10 or newer installed on your system.
2. Extract the downloaded ZIP file.
3. Open your terminal and navigate to the project root directory.
4. Run the application as a module using: `python -m src.grade_calculator`
5. (Optional) To run the tests, install pytest (`pip install pytest`) and run `pytest`.
Project files
Solution explanation
- `src/grade_calculator/models.py`: Immutable dataclasses and Enums (`Student`, `Grade`).
- `src/grade_calculator/service.py`: Contains the `GradeCalculator` and `GradingPolicy` protocols.
- `src/grade_calculator/io.py`: Handles safe terminal input and formatted output.
- `src/grade_calculator/__main__.py`: The application entry point.