Day 6 of Problem Solving Series In Python

Day 6 of Problem Solving Series In Python | Geethu Talks

Day 6 of Problem Solving Series

Day 6 of Problem Solving Series

👋 Hi friends! Geethu Talks ki welcome. Roju ₹50 save chesthe, konni rojullo entha avuthundo Python tho chuddam. Ee roju loops nerchukundam!

🎬 Reel chudaledha? Instagram / YouTube lo @GeethuTalks ni follow avvandi.

🧩 Real-life Problem

Kotha phone kosam roju ₹50 save cheyalani decide chesaru. N rojula tarvatha mee savings entha?

📋 Task: Days count teesukuni, prathi roju savings and final total print cheyyandi.
📥 Sample input: Days = 5
📤 Sample output: Total savings: ₹250

📚 Concepts Covered

  • 🔁 for loop and range()
  • 🧮 Accumulator pattern (total = total + 50)
  • 🔢 Loop variable
  • 🖨️ f-string tho progress print cheyadam

🧠 Step 1: Logic Build Cheddam

Same pani malli malli cheyyali, anduke loop:

  1. total = 0 tho start cheyyali
  2. Prathi roju total lo ₹50 add cheyyali
  3. Days anni ayyaka total print cheyyali
50 + 50 + 50 + 50 + 50 = ₹250

💡 Analogy: Piggy bank laga: prathi roju coin veyyadam. Loop ante aa pani ni repeat cheyadam, total ante bank lo unna money.

💻 Step 2: Python Code

days = int(input("Number of days: "))
total = 0

for day in range(1, days + 1):
    total = total + 50
    print(f"Day {day}: ₹{total}")

print(f"Total savings: ₹{total}")

✅ Output
Number of days: 5
Day 1: ₹50
Day 2: ₹100
Day 3: ₹150
Day 4: ₹200
Day 5: ₹250
Total savings: ₹250

🔍 Line by line


CodeMeaning
total = 0Savings zero tho start (loop mundu)
range(1, days + 1)Day 1 nunchi last day varaku
total = total + 50Prathi roju ₹50 add
print(f"Day {day}...")Prathi roju growing total chupinchadam
print(f"Total...")Loop aipoyaka final total

⚠️ Common Mistake Alert

❌ Wrong: total = 0 ni loop lopala petti, prathi roju reset chesthe

for day in range(1, 4):
    total = 0
    total = total + 50
print(total)

Result:
50

✅ Right: total = 0 ni loop mundu okkasari rayandi.

💡 Bonus tip: range(days) 0 nunchi start avuthundi, last number include avvadu. Day 1 nunchi kavali ante range(1, days + 1).

📝 Quick Recap

  • ✔️ for loop tho repeat chesam
  • ✔️ Accumulator: total lo add chesukuntu povadam
  • ✔️ total = 0 eppudu loop mundu

🏋️ Practice Problems

🟢 Easy: 1 nunchi N varaku numbers sum cheyyandi.
Input: 10 → Output: 55


🟡 Medium: 7 multiplication table 10 varaku print cheyyandi.
Output: 7 x 1 = 7 … 7 x 10 = 70


🔴 Challenge: Day 1 ₹50 save, tarvatha prathi roju ₹10 ekkuva (50, 60, 70…). 5 rojula total entha?
Expected output: ₹350


💬 Mee answers comments lo share cheyyandi!

🚀 Next: Day 7 – ATM PIN Attempts

Follow @GeethuTalks and stay tuned! 💛

⬅️ Previous: Day 5 of Problem Solving Series In Python

check out our website for more resources

1 thought on “Day 6 of Problem Solving Series In Python”

Leave a Comment