Day 5 of Problem Solving Series In Python | Geethu Talks

Table of Contents
Day 5 of Problem Solving Series
๐ Hi friends! Geethu Talks ki welcome. College attendance tension andariki telusu. Ee roju Python tho attendance status check cheddam.
๐ฌ Reel chudaledha? Instagram / YouTube lo @GeethuTalks ni follow avvandi.
๐งฉ Real-life Problem
Total 100 classes lo meeru 72 attend ayyaru. Exam ki eligible na, shortage na, critical na?
๐ Task: Attended and total classes teesukuni percentage calculate cheyyandi. 75% or above โ Eligible, 65% to below 75% โ Shortage, below 65% โ Critical.
๐ฅ Sample input: Attended = 72, Total = 100
๐ค Sample output: Shortage
๐ Concepts Covered
- ๐
if-elif-elsemultiple conditions - ๐ Percentage calculation
- ๐ถ Condition order
- ๐ก๏ธ Input validation
๐ง Step 1: Logic Build Cheddam
Mundu percentage, tarvatha 3 groups:
- Percentage = attended รท total ร 100
- 75 or above โ Eligible
- 65 to below 75 โ Shortage
- 65 kinda โ Critical
๐ก Analogy: if-elif-else students ni 3 groups ga divide cheyadam laga. Python conditions order lo check chesi, first match dagara aagipothundi.
๐ป Step 2: Python Code
attended = int(input("Attended classes: "))
total = int(input("Total classes: "))
if 0 <= attended <= total and total > 0:
percentage = (attended / total) * 100
if percentage >= 75:
print("Eligible")
elif percentage >= 65:
print("Shortage")
else:
print("Critical")
else:
print("Invalid class counts")
โ
Output
Attended classes: 72
Total classes: 100
Shortage
๐ Line by line
| Code | Meaning |
|---|---|
attended / total * 100 | Attendance percentage |
if percentage >= 75 | First: Eligible check |
elif percentage >= 65 | Eligible kaaka pothe, 65 or above ayithe Shortage |
else | Migilina andaru Critical |
total > 0 | Total zero ayithe divide error radu |
โ ๏ธ Common Mistake Alert
โ Wrong: Conditions order maarchesthe. 80% unna vallu kuda Shortage avutharu
percentage = 80
if percentage >= 65:
print("Shortage")
elif percentage >= 75:
print("Eligible")
Result:
Shortage
โ
Right: Always biggest condition (>= 75) first check cheyyandi.
๐ก Bonus tip: 65% anedi ee exercise lo example matrame. Mee college rules emi unnayo adi use cheyyandi.
๐ Quick Recap
- โ๏ธ
if-elif-elsetho 3 results - โ๏ธ Condition order chala important
- โ๏ธ Total zero check tho error radu
๐๏ธ Practice Problems
๐ข Easy: Marks teesukuni grade ivvandi: 90 or above โ A, 75 or above โ B, otherwise C.
Input: 82 โ Output: B
๐ก Medium: 80 classes lo 58 attend ayyaru. Percentage and status print cheyyandi.
Expected output: 72.50% โ Shortage
๐ด Challenge: Weight (kg) and height (m) teesukuni BMI = weight / (height ร height) calculate cheyyandi. Below 18.5 โ Underweight, below 25 โ Normal, below 30 โ Overweight, otherwise Obese.
Input: 70 and 1.75 โ BMI 22.86 โ Normal
๐ฌ Mee answers comments lo share cheyyandi!
๐ Next: Day 6 โ Daily Savings Challenge
Follow @GeethuTalks and stay tuned! ๐
โฌ ๏ธ Previous: Day 4 of Problem Solving Series In Python


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