Splitting The Bill
Part of the Fundamentals section of Coddy's Python journey — lesson 33 of 77.
Challenge
BeginnerAdd to the program a splitting feature:
- It will take an additional number (
int) from the user that indicates the number of people splitting the bill. (This will be the third input) - Calculate the amount per person by dividing the total amount by the number of people.
- In the end, add another print of the amount per person.
Important: Your program should output exactly two numbers:
- First: the total amount (including tip)
- Second: the amount per person
Note: For this step, print only the two numeric values (one per line) — no title or labels. You'll add the "Bill Split Calculator" title back, with formatting, in the next lesson.
Try it yourself
print("Bill Split Calculator")
bill_amount = float(input())
tip_percentage = float(input())
tip_amount = (tip_percentage / 100) * bill_amount
total_amount = bill_amount + tip_amount
print(total_amount)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 2