You are browsing as a guest. Sign up (or log in) to start making projects!

CLI Persistent Student Database

  • 1 Devlogs
  • 2 Total hours

While working on MIRA i noticed that I would always have to look up Python syntax and its getting difficult so instead of hitting in a roadblock later I decided to create this project to strenghten my Python fundamentls. It is a Command Line Interface (CLI) application that allows users to add, view, and store student records. To make it a usable tool, I will implement File I/O, so the database writes to a local .csv file and loads the persistent data on startup

Open comments for this post

2h 7m 58s logged

CLI Student Database — First Steps Into Python

Work Completed:

  • Initialized a student database CLI and implemented basic data persistence using JSON.
  • Built robust input validation (try/except loops) to handle invalid menu choices and prevent the program from crashing on typos (like typing abc for an integer).
  • Restricted range entries (e.g., age 0–20, grades 1–13) to prevent garbage data insertion.
  • Expanded the menu to a full CRUD flow: Add (with duplicate detection), View, Search (case-insensitive partial match), Update, Delete (with confirmation), and Statistics.
  • Implemented an auto-save routine that writes to the JSON file after every database mutation (Add, Update, Delete) to prevent data loss.
  • Refactored the validation parameters into centralized constants at the top of the file to make maintenance easier.

The Struggle: Smart Edits & Empty Inputs

The biggest logic challenge was the Update feature. I didn’t want to force users to re-type a student’s age and grade if they only wanted to change one of them.

My solution was checking if the input is empty using .strip() and evaluating it dynamically:

new_age = input("New age (press Enter to keep current): ").strip()
if new_age:
    database[name]["age"] = int(new_age)

If they just hit Enter, Python evaluates the empty string as falsy and safely skips the update, leaving the old value intact. It was a simple fix, but it made the CLI feel better


Next Steps:

  • Sorting data: Study how to sort dictionary outputs by name, age, or grade.
  • Grade labels: Map numerical grades to letter categories (A/B/C/D/F). So 90 would be A
  • Nested structures: Expand the schema to support multiple subjects per student.
  • Data Export: Learn the csv module to output student lists to a spreadsheet format.
  • System Refactoring: Move the program toward Object-Oriented Programming (OOP) classes, and eventually migrate JSON file storage to a lightweight SQLite database.

Conclusion

A few hours ago this was a script that crashed on bad input and forgot your data. Now it’s a small application with validation, persistence, and a proper menu. The biggest win wasn’t any single feature — it was realizing that I can take a broken thing, isolate the problem, and fix it incrementally. That’s the actual skill. It was a great excersice to pracitce coding while I wait for my MIRA training to complete.

0
0
1

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…