Formatted Output
Part of the Fundamentals section of Coddy's Python journey. Lesson 34 of 77.
Challenge
BeginnerThe last step of this project is to format the output!
For example, for the following input:
100 #bill
5 #tip percent
2 #number of peopleOutput in the following format:
Bill Split Calculator
Total (including tip): $105.0
Each person pays: $52.5Important 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
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
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Logical Operators Part 47Bill Split Calculator
Welcome MessageGetting Input8Loops
For LoopWhile LoopBreakContinueRecap - FactorialThe Range FunctionNested LoopRecap - Dynamic Input3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators9Functions
Declare a FunctionArgumentsReturnRecap - Sigma FunctionRecap - Validation FunctionDefault Values12Iterating Over Sequences
Iterating Over ElementsThe Enumerate FunctionIterating Over Strings Part 1Iterating Over Strings Part 2Practice on your own: Online Python compiler