Menu
Coddy logo textTech

Formatted Output

Part of the Fundamentals section of Coddy's Python journey — lesson 34 of 77.

challenge icon

Challenge

Beginner

The last step of this project is to format the output!

For example, for the following input:

100 #bill
5 #tip percent
2 #number of people

Output in the following format:

Bill Split Calculator
Total (including tip): $105.0
Each person pays: $52.5

Important formatting notes:

  • The output should be exactly the same as shown, including all uppercase letters and symbols
  • Do not round the numbers - use Python's default float formatting (no .2f or similar)
  • When numbers are converted to float type, Python will display them with varying decimal places (e.g., 105.0, 52.5, 164.28571428571428)
  • Use f-strings to insert the calculated values directly: f"${variable_name}"

Try it yourself

print("Bill Split Calculator")

bill_amount = float(input())
tip_percentage = float(input())
num_people = int(input())

tip_amount = (tip_percentage / 100) * bill_amount
total_amount = bill_amount + tip_amount
amount_per_person = total_amount / num_people

print(total_amount)
print(amount_per_person)

All lessons in Fundamentals