Day 1 of Problem Solving Series In Python

Day 1 of Problem Solving Series In Python | Geethu Talks

Day 1 of Problem Solving Series

Day 1 of Problem Solving Series

👋 Hi friends! Geethu Talks ki welcome. Syntax telusu, kani problem solve cheyadam ravatleda? Ee 30 days series mikosame! Prathi roju oka real-life problem, logic, code, and oka common mistake nerchukundam.

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

🧩 Real-life Problem

Four college friends ₹500 pizza order chesaru. Andaru equal ga pay cheyyali. Each person entha pay cheyyali?

📋 Task: Total bill and friends count teesukuni, each person’s share print cheyyandi.
📥 Sample input: Bill = ₹500, Friends = 4
📤 Sample output: Each person pays ₹125.00

📚 Concepts Covered

  • ⌨️ input() – user nunchi value teesukovadam
  • 🔢 int() and float() – text ni number ga marchadam
  • ➗ Division operator /
  • 🖨️ print() and f-string

🧠 Step 1: Logic Build Cheddam

Code kanna mundu logic! Manaki 2 values kavali:

  1. Total bill
  2. Number of friends
  3. Bill ni friends tho divide chesthe each person’s share vasthundi
₹500 ÷ 4 = ₹125

💡 Analogy: input() ante cashier ni total adagadam, division ante amount ni split cheyadam, print() ante andariki share chupinchadam.

💻 Step 2: Python Code

bill = float(input("Enter total bill: "))
friends = int(input("Number of friends: "))

if friends > 0:
    share = bill / friends
    print(f"Each person pays ₹{share:.2f}")
else:
    print("Friends must be at least 1")

✅ Output
Enter total bill: 500
Number of friends: 4
Each person pays ₹125.00

🔍 Line by line


CodeMeaning
float(input(...))Bill teesukuni decimal number ga marchadam
int(input(...))Friends count ni whole number ga marchadam
if friends > 0Zero tho divide cheyyakunda check
bill / friendsEach person share
{share:.2f}2 decimal places lo chupinchadam

⚠️ Common Mistake Alert

❌ Wrong: Friends = 0 enter chesthe

share = bill / friends
# ZeroDivisionError: float division by zero

✅ Right: Divide cheyyadaniki mundu if friends > 0 tho check cheyyandi.

💡 Bonus tip: input() eppudu text istundi. int() / float() marchakapothe calculation error vasthundi.

📝 Quick Recap

  • ✔️ Input teesukunnam (input())
  • ✔️ Type marchamu (int(), float())
  • ✔️ Divide chesi result print chesam
  • ✔️ Zero check marchipovaddu!

🏋️ Practice Problems

🟢 Easy: Total bill ₹900, friends 6. Each person entha pay cheyyali?
Expected output: ₹150.00


🟡 Medium: Hours teesukuni minutes ga convert cheyyandi.
Input: 2.5 → Output: 150.0 minutes


🔴 Challenge: Bill ₹1200, friends 5, and 10% tip kuda add cheyyali. Each person entha pay cheyyali?
Expected output: ₹264.00


💬 Mee answers comments lo share cheyyandi!

🚀 Next: Day 2 – UPI Balance Calculator

Follow @GeethuTalks and stay tuned! 💛

check out our website for more resources

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

Leave a Comment