Tip Calculator
Calculate tip and total bill.
BeginnerPhase 6 - Category 5: Real-World Logic ProblemsExample 10 of 15
tip-calculator.py
1# Take inputs2bill = float(input("Enter bill amount: "))3tip_percent = float(input("Enter tip percentage: "))4people = int(input("Enter number of people: "))56# Calculate7tip_amount = (bill * tip_percent) / 1008total = bill + tip_amount9per_person = total / people1011print(f"Tip amount: {tip_amount:.2f}")12print(f"Total bill: {total:.2f}")13print(f"Per person: {per_person:.2f}")
Output
Enter bill amount: 100 Enter tip percentage: 15 Enter number of people: 4 Tip amount: 15.00 Total bill: 115.00 Per person: 28.75
What's going on
Calculate tip and split bill.
Key Concepts:
Calculate tip amount
Add to bill for total
Divide by number of people
🔗Related Content
- 📖
Phase 6 - Learn Concepts
Review Phase 6 concepts and explanations
- 📝
Phase 6 - Quiz
Test your Phase 6 understanding with quiz questions
- 💻
Phase 6 - All Practice Problems
Explore all practice problems for Phase 6
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum