DAY 47 — 60 DAY PYTHON CHALLENGE
School Management
Python mein School Management banao — Hindi mein step by step
Advertisement
Project kya hai?
Day 47 ka project hai School Management!
Yeh project banane se aap Python ke important concepts
practice kar payenge. Neeche complete code hai — copy karo aur chalao!
Complete Python Code
python — school.py
class School:
def __init__(self, name):
self.name = name
self.students = {}
self.teachers = {}
self.classes = {}
def add_student(self, name, cls):
roll = len(self.students) + 1
self.students[roll] = {"name": name, "class": cls, "fees": False}
if cls not in self.classes:
self.classes[cls] = []
self.classes[cls].append(name)
print(f"Student add hua - Roll:{roll} {name} (Class {cls})")
def add_teacher(self, name, subject):
self.teachers[name] = subject
print(f"Teacher add hua: {name} ({subject})")
def pay_fees(self, roll):
if roll in self.students:
self.students[roll]["fees"] = True
print(f"Fees paid: {self.students[roll]['name']}")
else:
print("Student nahi mila!")
def class_list(self, cls):
students = self.classes.get(cls, [])
print(f"\nClass {cls} students ({len(students)}):")
for s in students:
print(f" - {s}")
def report(self):
fees_pending = [d["name"] for d in self.students.values() if not d["fees"]]
print(f"\n=== {self.name} Report ===")
print(f" Total Students : {len(self.students)}")
print(f" Total Teachers : {len(self.teachers)}")
print(f" Fees Pending : {fees_pending}")
s = School(input("School naam: "))
while True:
print("\n1. Student add")
print("2. Teacher add")
print("3. Fees pay")
print("4. Class list")
print("5. Report")
print("6. Baahar jao")
ch = input("Choice: ")
if ch == "1": s.add_student(input("Naam: "), input("Class: "))
elif ch == "2": s.add_teacher(input("Teacher naam: "), input("Subject: "))
elif ch == "3": s.pay_fees(int(input("Roll number: ")))
elif ch == "4": s.class_list(input("Class: "))
elif ch == "5": s.report()
elif ch == "6": break
OUTPUT
School naam: Delhi Public School Student add hua - Roll:1 Rahul (Class 10) Teacher add hua: Sharma (Math) === Delhi Public School Report === Total Students : 2 Total Teachers : 1 Fees Pending : ['Rahul']
Code kaise kaam karta hai?
Dictionary mein roll=key se fast access hota hai. Class-wise list alag track hoti hai. Fees pending list se school administration easy hoti hai.
Advertisement
📋 Project ka Introduction
School Management Python ka Day 47 ka project hai. Is project mein aap Python ke important concepts practice karenge jo real-world applications mein bahut use hote hain.
Yeh project beginners ke liye design kiya gaya hai lekin kaafi concepts cover karta hai. Step by step samjho, code chalao, aur khud modify karke practice karo.
Is tarah ke projects banane se aapka Python confidence badh jaata hai aur aap asli problems solve karna seekh jaate hain. Chaliye code samjhte hain!
Yeh project beginners ke liye design kiya gaya hai lekin kaafi concepts cover karta hai. Step by step samjho, code chalao, aur khud modify karke practice karo.
Is tarah ke projects banane se aapka Python confidence badh jaata hai aur aap asli problems solve karna seekh jaate hain. Chaliye code samjhte hain!
🧠 Is Project mein kya seekhoge?
Yeh project banate waqt aap ye Python concepts use karoge:
| Concept | Kya karta hai |
|---|---|
Variables | Data store karna |
Functions | Reusable code blocks |
Loops | Repeat karna |
Conditions | Decisions lena |
Input/Output | User se interact karna |
📝 Code kaise kaam karta hai — Step by Step
Neeche code ki poori logic step-by-step samjhayi gayi hai:
- Problem samjho: School Management mein kya karna hai
- Required variables aur data structures decide karo
- Logic step-by-step likhó
- Code mein implement karo
- Test karo aur bugs fix karo
⚠️ Common Mistakes — Bhool mat jaana!
Beginners yeh galtiyan aksar karte hain — dhyan rakho:
- ⚠️ Indentation sahi rakho — Python mein spaces matter karti hain
- ⚠️ Variables ko use se pehle define karo
- ⚠️ Input ko int()/float() mein convert karo agar number chahiye
- ⚠️ Edge cases handle karo — kya hoga agar user galat input de?
🏋️ Practice Exercises — Aage badho!
Yeh project complete karne ke baad in exercises se practice karo:
- 💡 School Management mein naya feature add karo
- 💡 Code ko functions mein refactor karo
- 💡 Error handling improve karo
- 💡 File mein data save karo
❓ Aksar Pooche Jane Wale Sawal (FAQ)
Q: School Management project kyon banana chahiye?
A: Har project ek naya concept sikhata hai. Practice se hi Python fluent aati hai.
A: Har project ek naya concept sikhata hai. Practice se hi Python fluent aati hai.
Q: Code run nahi ho raha?
A: Indentation check karo, syntax errors dekho, variables define hain ya nahi check karo.
A: Indentation check karo, syntax errors dekho, variables define hain ya nahi check karo.
Q: Kaise improve karein?
A: Pehle basic version complete karo, phir ek ek feature add karte jao.
A: Pehle basic version complete karo, phir ek ek feature add karte jao.