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: keep the Bill Split Calculator title line from the starter code, then print two numbers, one per line:
- First: the total amount (including tip)
- Second: the amount per person
Try it yourself
print("Bill Split Calculator")
bill_amount = float(input())
tip_percentage = float(input())
num_people = int(input())
# Calculate tip amount
# Calculate total amount
# Calculate amount per person
# Print total amount
# Print amount per personAll 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