Day 12 of Problem Solving Series In Python

Day 12 of Problem Solving Series In Python | Geethu Talks

Day 12 of Problem Solving Series

Day 12 of Problem Solving Series

👋 Hi friends! Geethu Talks ki welcome. Creators ki idi daily pani: entha posts target cross chesayo count cheyyadam. Python tho chuddam!

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

🧩 Real-life Problem

Mee 6 posts likes: 120, 85, 240, 100, 99, 310. Entha posts 100 likes cross chesayi?

📋 Task: Likes list lo 100 kanna ekkuva likes unna posts count cheyyandi.
📥 Sample input: [120, 85, 240, 100, 99, 310]
📤 Sample output: Posts above 100 likes: 3

📚 Concepts Covered

  • 🔢 Counter variable
  • 🔀 if inside for
  • 📶 Indentation importance
  • ⚖️ > vs >=

🧠 Step 1: Logic Build Cheddam

Idi count pattern: condition true ayinappudu matrame counter penchali.

  1. count = 0 tho start
  2. Prathi like value check cheyyali
  3. 100 kanna ekkuva ayithe matrame count + 1
  4. Loop aipoyaka count print
120 ✔️   85 ❌   240 ✔️   100 ❌   99 ❌   310 ✔️  = 3

💡 Analogy: Attendance register laga: condition meet ayina vallaki matrame tick veyyadam, last lo ticks count.

💻 Step 2: Python Code

likes = [120, 85, 240, 100, 99, 310]
count = 0

for like in likes:
    if like > 100:
        count = count + 1

print(f"Posts above 100 likes: {count}")

✅ Output
Posts above 100 likes: 3

🔍 Line by line


CodeMeaning
count = 0Counter zero tho
for like in likesPrathi post likes
if like > 100100 cross chesinda? (100 exact kaadu)
count = count + 1if lopala undali (indent)
print(...)Final count

⚠️ Common Mistake Alert

❌ Wrong: count = count + 1 ni if bayata rasthe anni posts count avuthayi

likes = [120, 85, 240]
count = 0
for like in likes:
    if like > 100:
        print("Crossed 100")
    count = count + 1
print(count)

Result:
Crossed 100
Crossed 100
3

✅ Right: count = count + 1 ni if kinda indent cheyyandi, so condition true ayithe matrame run avuthundi.

💡 Bonus tip: ‘Cross chesayi’ ante > 100. 100 exact unte cross cheyyaledu. Problem statement jagrattaga chadvandi!

📝 Quick Recap

  • ✔️ Counter 0 tho start
  • ✔️ Condition true ayithe matrame count + 1
  • ✔️ Indentation tho logic maaripothundi

🏋️ Practice Problems

🟢 Easy: Marks [45, 20, 67, 34, 90] lo pass (35 or more) ayina students entha?
Expected output: 3


🟡 Medium: List [-3, 5, 0, 8, -1] lo positive numbers entha?
Expected output: 2


🔴 Challenge: Sentence lo 5 letters kanna pedda words entha? (hint: split())
Input: python makes problem solving simple → Output: 4


💬 Mee answers comments lo share cheyyandi!

🚀 Next: Day 13 – WhatsApp Message Analyzer

Follow @GeethuTalks and stay tuned! 💛

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

check out our website for more resources

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

Leave a Comment