A Python command-line application that saves student marks to a CSV file with automatic grade calculation and persistent storage.
- ✅ Add students with name and marks
- ✅ Automatic grade calculation
- ✅ Save data permanently to CSV file
- ✅ View all students in neat format
- ✅ Error handling for invalid input
- ✅ Header written only once automatically
- ✅ Skips empty rows when reading
- Python functions
- CSV file handling (read/write)
- OS module (file existence check)
- Error handling (try/except)
- While loops and menu system
- String formatting (f-strings)
- next() to skip header row
- append mode for data persistence
student-marks-saver/
├── student_marks_saver.py # Main program
├── students.csv # Auto-created on first run
└── README.md # Project documentation
Python 3.x installed
# Clone the repository
git clone https://github.com/umer-analysis/student-marks-saver.git
# Go to project folder
cd student-marks-saver
# Run the program
python student_marks_saver.py1. Add student
2. Show all
3. Quit
Choose: 1
Name : Umer
Marks: 90
✅ Umer saved.
-----------------------------------
Name: Umer Marks: 90 Grade: A
Name: Ali Marks: 75 Grade: B
Name: Sara Marks: 45 Grade: Fail
-----------------------------------
Choose: 3
Goodbye! 👋
| Marks | Grade |
|---|---|
| 90 – 100 | A |
| 70 – 89 | B |
| 50 – 69 | C |
| Below 50 | Fail |
Data saved in students.csv:
name,marks,grade
Umer,90,A
Ali,75,B
Sara,45,Fail
CSV file grows every time
you add a new student! ✅
Data stays after program closes!
Invalid marks input:
Name : Umer
Marks: abc
❌ Invalid! Please enter a number.
→ Goes back to menu safely! ✅
Invalid menu choice:
Choose: 9
❌ Invalid choice! Enter 1, 2 or 3.
File not found:
→ "No students saved yet!" ✅
- Delete student feature
- Edit existing marks
- Search student by name
- Sort by marks highest to lowest
- Export report as PDF
- Calculate class average
- Show top 3 students
Umer Farooq
- GitHub : github.com/umer-analysis
- Fiverr : fiverr.com/umer_analysis
- Country : Pakistan 🇵🇰
This project is open source and available for learning purposes.
⭐ If you found this helpful, please give it a star on GitHub!