Day 001 of the 100 Days of Python challenge builds a command-line tip calculator. The program collects a bill total, a tip percentage, and the number of people sharing the bill, then calculates each person’s portion.

Project Overview

The program asks for three values:

  1. The total bill
  2. The tip percentage
  3. The number of people splitting the bill

It converts the bill to a float and the other values to int values. The tip is calculated as a percentage of the subtotal, added to the bill, and divided by the number of people.

Welcome to the tip calculator!
What was the total bill?
$120
How much tip would you like to give? $10, $12, or $15?
15
How many people to split the bill?
4
Each person should pay: $34.50

How It Works

The calculation is separated into clear steps:

tip_amount = sub_total * (tip / 100)
total_bill = sub_total + tip_amount
pay_per_person = total_bill / people

The final f-string formats the result to exactly two decimal places with :.2f, which is useful for currency output.

The script also wraps its work in main() and uses the main-module guard so the function runs when the file is executed directly.

What This Project Teaches

Day 001 provides practice with numeric data types, type conversion, percentage calculations, f-strings, and functions. It also shows why choosing the right type matters: the bill requires decimal support, while a tip percentage and people count can be whole numbers.

Running the Project

git clone https://github.com/victorhugo81/100daysofpython.git
cd 100daysofpython/day001
python main.py

View the Day 001 source code on GitHub.