🟢 Day 7 — Mini Project & Programmer Thinking
1️⃣ Why a Mini Project?
Until now, you learned:
But in isolation.
💡 Real programs are just small pieces working together.
2️⃣ The Project: Student Management System
This project is intentionally simple, but real.
What the Program Should Do
3️⃣ Think Before Coding (MOST IMPORTANT PART)
Before writing any code, answer:
Step 1 — What Data Do We Need?
Multiple students → dictionary students = {
"Amit": 85,
"Neha": 90
}
Step 2 — What Actions Are Needed?
Each action → function
🧠 One action = one function
4️⃣ Program Flow (Mental Diagram)
START
|
|-- Show menu
|-- Take choice
|-- Call correct function
|-- Repeat until exit
END
💡 This is how every menu-driven program works.
5️⃣ Menu Loop (Core Structure)
while True:
print("1. Add student")
print("2. View students")
print("3. Search student")
print("4. Save & Exit")
choice = input("Enter choice: ")
if choice == "1":
add_student()
elif choice == "2":
view_students()
elif choice == "3":
search_student()
elif choice == "4":
save_to_file()
break
else:
print("Invalid choice")
🧠 This is real-world program structure.
6️⃣ Key Functions (Skeleton, Not Full Code)
Add Student
def add_student(students):
name = input("Enter name: ")
marks = int(input("Enter marks: "))
students[name] = marks
View Students
def view_students(students):
for name, marks in students.items():
print(name, marks)
Search Student
def search_student(students):
name = input("Enter name: ")
if name in students:
print(students[name])
else:
print("Not found")
7️⃣ Saving & Loading Data
Save to File
with open("students.txt", "w") as file:
for name, marks in students.items():
file.write(name + "," + str(marks) + "\n")
Load from File
students = {}
try:
with open("students.txt", "r") as file:
for line in file:
name, marks = line.strip().split(",")
students[name] = int(marks)
except:
pass
💡 File becomes your simple database.
8️⃣ Thinking Like a Programmer (IMPORTANT)
Whenever stuck, ask:
Can I break this into functions? What happens if input is wrong? 9️⃣ Practice Tasks (Extend the Project)
Q1
Add update student marks option.
Q2
Delete a student.
Q3
Prevent duplicate student names.
Q4
Show student with highest marks.
Q5
Validate marks (0–100 only).
Q6
Store data in file after every change.
Q7 (Thinking Question)
If program crashes midway, how can data loss be prevented?
🔑 HINTS (Read Together)
Use functions for every action Validate input using try/except Always think about failure cases ✅ What You Can Do After Day 7
After completing Day 7, the student can:
Write complete Python programs Think step-by-step logically Read other Python code confidently 🧠 Final Reflection (Answer in Words)
How does a program flow work? Why are functions important? Why dictionaries fit real data? How did your thinking change from Day 1? ⭐ Final Golden Rule
Programming is not typing code.
It is thinking clearly and expressing it precisely.
🎉 Congratulations
If someone completes all 7 days properly, they now:
Have real programming fundamentals Can learn any language later Understand how software actually works