Day 5 of Problem Solving Series In Python

Day 5 of Problem Solving Series In Python | Geethu Talks

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-else multiple conditions
  • ๐Ÿ“Š Percentage calculation
  • ๐Ÿ“ถ Condition order
  • ๐Ÿ›ก๏ธ Input validation

๐Ÿง  Step 1: Logic Build Cheddam

Mundu percentage, tarvatha 3 groups:

  1. Percentage = attended รท total ร— 100
  2. 75 or above โ†’ Eligible
  3. 65 to below 75 โ†’ Shortage
  4. 65 kinda โ†’ Critical
72 รท 100 ร— 100 = 72% โ†’ Shortage

๐Ÿ’ก 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


CodeMeaning
attended / total * 100Attendance percentage
if percentage >= 75First: Eligible check
elif percentage >= 65Eligible kaaka pothe, 65 or above ayithe Shortage
elseMigilina andaru Critical
total > 0Total 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-else tho 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

check out our website for more resources

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

Leave a Comment