A practical Python application that helps split expenses fairly among multiple people. Supports equal splits, splits with tips, and custom splits with different ratios. Perfect for splitting restaurant bills, shared expenses, or group activities.
- Equal Split: Divide expenses equally among all people
- Split with Tip: Calculate split including tip percentage
- Custom Split: Different ratios for different people
- Multiple currency support
- Type hints for better code quality
- Formatted output with thousands separators
- Input validation and error handling
- Interactive menu system
- Recursive option to calculate multiple splits
- Language: Pure Python
- Libraries: None (pure Python standard library)
- Complexity: Beginner
No external dependencies required!
# Run the program
python main.pypython main.pySelect option 1 and follow prompts:
Enter total expense amount: 1500
Enter number of people: 3
Enter currency symbol (default $): ₹
==================================================
EXPENSE SPLIT CALCULATION
==================================================
Total expenses: ₹1,500.00
Number of people: 3
Each person should pay: ₹500.00
==================================================
Select option 2:
Enter total expense amount (before tip): 100
Enter number of people: 4
Enter tip percentage (e.g., 15 for 15%): 15
Enter currency symbol (default $): $
==================================================
EXPENSE SPLIT WITH TIP
==================================================
Subtotal: $100.00
Tip (15.0%): $15.00
Total with tip: $115.00
Number of people: 4
Each person should pay: $28.75
==================================================
Select option 3 for different ratios:
Enter total expense amount: 300
Enter currency symbol (default $): $
Enter person names and their share ratios
(e.g., if Alice pays 2x and Bob pays 1x, enter 2 for Alice and 1 for Bob)
Enter blank name to finish
Person name: Alice
Share ratio for Alice: 2
Person name: Bob
Share ratio for Bob: 1
Person name: Charlie
Share ratio for Charlie: 1
Person name:
==================================================
CUSTOM EXPENSE SPLIT
==================================================
Total expenses: $300.00
Individual shares:
------------------------------------------------------------
Alice ( 50.0%): $150.00
Bob ( 25.0%): $75.00
Charlie ( 25.0%): $75.00
==================================================
share_per_person = total_amount / number_of_peopletip_amount = total_amount * (tip_percentage / 100)
total_with_tip = total_amount + tip_amount
share_per_person = total_with_tip / number_of_peopletotal_shares = sum(all_share_ratios)
person_amount = (person_share / total_shares) * total_amountCalculates equal split among all people.
Parameters:
total_amount(float): Total expensenumber_of_people(int): Number of peoplecurrency(str): Currency symbol
Calculates split including tip.
Parameters:
total_amount(float): Subtotal before tipnumber_of_people(int): Number of peopletip_percentage(float): Tip percentagecurrency(str): Currency symbol
Calculates split with custom ratios.
Parameters:
total_amount(float): Total expenseshares(dict): Dictionary of {name: ratio}currency(str): Currency symbol
- Split bill equally among friends
- Include tip calculation
- Handle different payment ratios (someone orders more)
- Split rent and utilities
- Different room sizes = different ratios
- Monthly recurring expenses
- Split hotel costs
- Divide transportation expenses
- Share activity costs
- Split delivery order
- Include delivery fee and tip
- Handle different meal costs
4 friends, $120 bill, 18% tip
Result: Each pays $35.40
3 roommates, $1500 rent
Alice (master bedroom): 2 shares
Bob (regular room): 1 share
Charlie (regular room): 1 share
Result: Alice $750, Bob $375, Charlie $375
5 people, $100 gift
Result: Each contributes $20.00
- Validates number of people ≥ 1
- Checks for valid numeric input
- Handles division by zero
- Validates share ratios
- Catches keyboard interrupts
- Provides clear error messages
def calculate_with_tax_and_tip(total, people, tax_pct, tip_pct, currency="$"):
tax = total * (tax_pct / 100)
subtotal_with_tax = total + tax
tip = subtotal_with_tax * (tip_pct / 100)
grand_total = subtotal_with_tax + tip
per_person = grand_total / people
return per_persondef track_payments(shares, paid):
"""Track who has paid and who owes"""
for person, amount in shares.items():
status = "✓ Paid" if person in paid else "✗ Pending"
print(f"{person}: ${amount:.2f} - {status}")import csv
def export_split(filename, data):
with open(filename, 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['Person', 'Amount', 'Currency'])
for person, amount in data.items():
writer.writerow([person, amount, currency])- Function design with type hints
- Dictionary operations
- String formatting with f-strings
- Input validation
- Error handling with try-except
- Mathematical calculations
- User interface design (CLI)
- Code organization and modularity
- GUI version with Tkinter
- Save split history to database
- Generate payment links (Venmo, PayPal)
- QR code generation for payments
- Email/SMS notifications
- Multiple currency conversion
- Receipt scanning (OCR)
- Group expense tracking over time
- Settle up calculations (who owes whom)
- Export to PDF/Excel
- Mobile app version
- Integration with payment apps
| Service Quality | Tip % |
|---|---|
| Poor | 10% |
| Average | 15% |
| Good | 18% |
| Excellent | 20% |
| Outstanding | 25%+ |
- $ - US Dollar, Canadian Dollar, Australian Dollar
- € - Euro
- £ - British Pound
- ¥ - Japanese Yen, Chinese Yuan
- ₹ - Indian Rupee
- ₽ - Russian Ruble
- ₩ - South Korean Won
This project is open source and available for educational purposes.