Day 15 of Problem Solving Series In Python | Geethu Talks

Table of Contents
Day 15 of Problem Solving Series
👋 Hi friends! Geethu Talks ki welcome. Week 3 start! Ee roju dictionaries nerchukundam: name tho marks ni instant ga find cheyyadam.
🎬 Reel chudaledha? Instagram / YouTube lo @GeethuTalks ni follow avvandi.
🧩 Real-life Problem
Class lo students marks unnayi. Oka student peru enter chesthe, aa student marks cheppali.
📋 Task: Marks dictionary create cheyyandi. Peru teesukuni marks print cheyyandi, peru lekapothe ‘Student not found’ cheppandi.
📥 Sample input: Sita
📤 Sample output: Sita scored 92
📚 Concepts Covered
- 📖 Dictionary: key → value
- 🔍
into check key - 🔑
dict[key]lookup - 🛟
.get()safe lookup
🧠 Step 1: Logic Build Cheddam
List lo vethakadaniki prathi item check cheyyali. Dictionary lo peru ichchi direct ga marks teesukovachu:
- Dictionary lo name → marks pairs petti
- User nunchi peru teesukovali
- Peru dictionary lo undha check
- Unte marks print, lekapothe not found
💡 Analogy: Phone contacts laga: peru ichchi number teesukuntam, antha contacts scroll cheyyam.
💻 Step 2: Python Code
marks = {"Ravi": 78, "Sita": 92, "Arjun": 65, "Geethu": 88}
name = input("Enter student name: ")
if name in marks:
print(f"{name} scored {marks[name]}")
else:
print("Student not found")
✅ Output
Enter student name: Sita
Sita scored 92
🔍 Line by line
| Code | Meaning |
|---|---|
{"Ravi": 78, ...} | Key: value pairs |
name in marks | Key undha ani check |
marks[name] | Key tho value teesukovadam |
else | Peru lekapothe message |
⚠️ Common Mistake Alert
❌ Wrong: Peru case match avvakapothe (sita vs Sita) KeyError vasthundi
marks = {"Sita": 92}
print(marks["sita"])
# KeyError: 'sita'
✅ Right: Mundu in tho check cheyyandi, leda marks.get(name, "Not found") vadandi.
💡 Bonus tip: Dictionary keys case-sensitive. ‘Sita’ and ‘sita’ veru veru keys.
📝 Quick Recap
- ✔️ Dictionary: key-value pairs
- ✔️
intho key check - ✔️
.get()tho safe lookup
🏋️ Practice Problems
🟢 Easy: Contacts dictionary {“Amma”: “9000011111”, “Anna”: “9000022222”} lo peru tho number search cheyyandi.
Input: Amma → Output: 9000011111
🟡 Medium: Ravi marks ki 5 add chesi update cheyyandi.
Output: Ravi now has 83
🔴 Challenge: Marks dictionary lo highest marks vachina student peru print cheyyandi (hint: .items()).
Output: Sita scored 92
💬 Mee answers comments lo share cheyyandi!
🚀 Next: Day 16 – Unique Participants
Follow @GeethuTalks and stay tuned! 💛
⬅️ Previous: Day 14 of Problem Solving Series In Python
check out our website for more resources
Day 15 of Problem Solving Series Day 15 of Problem Solving Series Day 15 of Problem Solving Series


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