DAY 43 — 60 DAY PYTHON CHALLENGE
Bank System
Python mein Bank System banao — Hindi mein step by step
Advertisement
Project kya hai?
Day 43 ka project hai Bank System!
Yeh project banane se aap Python ke important concepts
practice kar payenge. Neeche complete code hai — copy karo aur chalao!
Complete Python Code
python — bank.py
class BankAccount:
def __init__(self, name, balance=0):
self.name = name
self.balance = balance
self.history = []
def deposit(self, amt):
if amt <= 0:
print("Amount sahi nahi!")
return
self.balance += amt
self.history.append(f" CREDIT +Rs{amt:,}")
print(f"Rs{amt:,} deposit hua! Balance: Rs{self.balance:,}")
def withdraw(self, amt):
if amt <= 0:
print("Amount sahi nahi!")
return
if amt > self.balance:
print("Balance kam hai!")
return
self.balance -= amt
self.history.append(f" DEBIT -Rs{amt:,}")
print(f"Rs{amt:,} withdraw hua! Balance: Rs{self.balance:,}")
def transfer(self, other, amt):
if amt > self.balance:
print("Balance kam hai!")
return
self.withdraw(amt)
other.deposit(amt)
print(f"Transfer ho gaya: Rs{amt:,} to {other.name}")
def statement(self):
print(f"\n=== {self.name} ka Statement ===")
print(f"Balance: Rs{self.balance:,}")
print("-" * 30)
for h in self.history:
print(h)
name = input("Account holder naam: ")
bal = float(input("Opening balance: Rs"))
acc = BankAccount(name, bal)
acc2 = BankAccount("Savings Account", 0)
while True:
print("\n1. Deposit")
print("2. Withdraw")
print("3. Transfer to Savings")
print("4. Statement")
print("5. Baahar jao")
ch = input("Choice: ")
if ch == "1":
acc.deposit(float(input("Amount: Rs")))
elif ch == "2":
acc.withdraw(float(input("Amount: Rs")))
elif ch == "3":
acc.transfer(acc2, float(input("Transfer amount: Rs")))
elif ch == "4":
acc.statement()
elif ch == "5":
break
OUTPUT
Account holder naam: Rahul Opening balance: Rs10000 Choice: 1 Amount: Rs5000 Rs5000 deposit hua! Balance: Rs15,000 === Rahul ka Statement === Balance: Rs15,000 ------------------------------ CREDIT +Rs5,000 DEBIT -Rs2,000
Code kaise kaam karta hai?
OOP ka perfect example! Class mein data aur methods ek saath hain. Transfer method se account-to-account money move hoti hai. Real bank jaisi functionality!
Advertisement
📋 Project ka Introduction
Bank System Python ka Day 43 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: Bank 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:
- 💡 Bank 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: Bank 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.