DAY 04 — 60 DAY PYTHON CHALLENGE
💻 Simple Interest Calculator
Python में Simple Interest Calculator — साधारण ब्याज
Advertisement
Complete Code
python — day04.py
def si_calculator(): print("💰 Simple Interest Calculator") print("Formula: SI = (P × R × T) / 100") print("-" * 38) try: P = float(input("मूलधन — Principal (₹): ")) R = float(input("ब्याज दर — Rate (%): ")) T = float(input("समय — Time (years): ")) SI = (P * R * T) / 100 total = P + SI print(f"\n{'='*38}") print(f" मूलधन (P): ₹{P:>10,.2f}") print(f" ब्याज दर (R): {R:>10}%") print(f" समय (T): {T:>10} years") print(f"{'─'*38}") print(f" साधारण ब्याज: ₹{SI:>10,.2f}") print(f" कुल राशि: ₹{total:>10,.2f}") print(f"{'='*38}") except ValueError: print("❌ सही number डालें!") si_calculator()
OUTPUT
======================================
मूलधन (P): ₹10,000.00
ब्याज दर (R): 5%
समय (T): 3 years
──────────────────────────────────────
साधारण ब्याज: ₹ 1,500.00
कुल राशि: ₹11,500.00
======================================
यह Code कैसे काम करता है?
SI = (P×R×T)/100 — यह basic finance formula है। f-string में :,.2f से comma और 2 decimal places format होते हैं। ₹ symbol directly use होता है।
Advertisement