Day 4 of Problem Solving Series In Python | Geethu Talks

Table of Contents
Day 4 of Problem Solving Series
๐ Hi friends! Geethu Talks ki welcome. 20% discount ante โน20 thagguthaya? Kaadu! Ee roju percentage logic nerchukundam.
๐ฌ Reel chudaledha? Instagram / YouTube lo @GeethuTalks ni follow avvandi.
๐งฉ Real-life Problem
Food delivery app lo โน500 or more bill ayithe 20% discount. Mee order โน600. Final bill entha?
๐ Task: Cart amount teesukuni, bill โน500 or more ayithe matrame 20% discount apply chesi final bill print cheyyandi.
๐ฅ Sample input: Bill = โน600
๐ค Sample output: Final bill: โน480.00
๐ Concepts Covered
- ๐ Percentage formula
- ๐ Conditional calculation
- ๐ข
float()input - ๐จ๏ธ f-string formatting
๐ง Step 1: Logic Build Cheddam
Mundu condition, tarvatha calculation:
- Bill 500 or above undha? Check cheyyali
- Yes ayithe: discount = bill ร 20 รท 100
- Final bill = bill โ discount
- No ayithe: bill alage untundi
๐ก Analogy: Discount condition coupon gate laga: minimum bill meet ayithe matrame coupon activate avuthundi.
๐ป Step 2: Python Code
bill = float(input("Enter bill amount: "))
if bill >= 500:
discount = bill * 20 / 100
bill = bill - discount
print(f"Final bill: โน{bill:.2f}")
โ
Output
Enter bill amount: 600
Final bill: โน480.00
๐ Line by line
| Code | Meaning |
|---|---|
float(input(...)) | Bill amount teesukovadam |
if bill >= 500 | Minimum bill condition |
bill * 20 / 100 | 20 percent amount |
bill - discount | Discount tharvatha final amount |
print(...) | if block bayata undi, so eppudu print avuthundi |
โ ๏ธ Common Mistake Alert
โ Wrong: 20% ante direct ga โน20 subtract cheyyadam
bill = 600
bill = bill - 20
print(bill)
Result:
580
โ
Right: bill * 20 / 100 tho percentage amount calculate chesi subtract cheyyandi.
๐ก Bonus tip: Percentage formula: amount * percent / 100. Idi tarvatha anni problems lo kuda vastundi.
๐ Quick Recap
- โ๏ธ Percentage = amount ร percent รท 100
- โ๏ธ Condition true ayithe matrame discount
- โ๏ธ Discount ledu ante bill same untundi
๐๏ธ Practice Problems
๐ข Easy: Bill โน400 ayithe final amount entha? (discount untunda?)
Expected output: โน400.00
๐ก Medium: โน1000 bill meeda 18% GST add chesi total bill print cheyyandi.
Expected output: โน1180.00
๐ด Challenge: Bill โน500 or more ayithe 20% discount. Tarvatha โน40 delivery charge add cheyyandi. Bill โน600 ayithe final entha?
Expected output: โน520.00
๐ฌ Mee answers comments lo share cheyyandi!
๐ Next: Day 5 โ College Attendance Calculator
Follow @GeethuTalks and stay tuned! ๐
โฌ ๏ธ Previous: Day 3 of Problem Solving Series In Python
check out our website for more resources
Day 4 of Problem Solving Series Day 4 of Problem Solving Series Day 4 of Problem Solving Series


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