DAY 29 — 60 DAY PYTHON CHALLENGE
💻 Student Grade System
Python में Student Grade System — छात्र ग्रेड सिस्टम
Advertisement
Project kya hai?
Day 29 ka project hai Student Grade System!
Neeche complete code hai — copy karo aur chalao!
Complete Python Code
python — grade.py
def calculate_grade(marks):
if marks >= 90: return "A+", "Outstanding"
if marks >= 80: return "A", "Excellent"
if marks >= 70: return "B", "Good"
if marks >= 60: return "C", "Average"
if marks >= 33: return "D", "Pass"
return "F", "Fail"
print("=== Student Grade System ===")
students = []
while True:
print("
1. Student add karo")
print("2. All students report")
print("3. Grade statistics")
print("4. Top 3 students")
print("5. Baahar jao")
ch = input("Choice: ")
if ch == "1":
name = input("Student naam: ")
subs = ["Hindi", "English", "Math", "Science", "Computer"]
marks = {}
for s in subs:
marks[s] = int(input(f" {s} marks (100 mein): "))
total = sum(marks.values())
pct = total / len(marks)
grade, status = calculate_grade(pct)
students.append({
"name": name, "marks": marks,
"total": total, "pct": pct,
"grade": grade, "status": status
})
print(f"
Report: {name}")
print(f" Total: {total}/500 | Avg: {pct:.1f}% | Grade: {grade} ({status})")
elif ch == "2":
if not students:
print("Koi student nahi!")
else:
sorted_s = sorted(students, key=lambda x: x["pct"], reverse=True)
print(f"
{'Naam':15} {'Total':8} {'Avg%':8} {'Grade'}")
print("-" * 40)
for s in sorted_s:
print(f" {s['name']:13} {s['total']:8} {s['pct']:7.1f}% {s['grade']} ({s['status']})")
elif ch == "3":
if students:
grades = {}
for s in students:
grades[s["grade"]] = grades.get(s["grade"], 0) + 1
print("
Grade Distribution:")
for g, count in sorted(grades.items()):
print(f" {g}: {'#'*count} ({count})")
elif ch == "4":
top = sorted(students, key=lambda x: x["pct"], reverse=True)[:3]
print("
Top 3 Students:")
for i, s in enumerate(top, 1):
print(f" {i}. {s['name']}: {s['pct']:.1f}% ({s['grade']})")
elif ch == "5":
break
OUTPUT
Student: Priya Hindi: 88, English: 92, Math: 95, Science: 87, Computer: 93 Report: Priya Total: 455/500 | Avg: 91.0% | Grade: A+ (Outstanding) Top 3 Students: 1. Priya: 91.0% (A+) 2. Rahul: 78.4% (B)
Code kaise kaam karta hai?
Dictionary mein subject-wise marks store hote hain. sorted(key=lambda, reverse=True) se ranking milti hai. Grade statistics se class performance pata chalti hai.
Advertisement
📋 Project ka Introduction
Student Grade System Python ka Day 29 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: Student Grade System 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:
- 💡 Student Grade System 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: Student Grade System 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.