Calculating The Tip And Total
Part of the Fundamentals section of Coddy's Python journey — lesson 32 of 77.
Challenge
BeginnerCreate a bill tip calculator program that follows these steps:
- Print "Bill Split Calculator" as the program title
- Get the bill amount from user input
- Get the tip percentage from user input
- Calculate the tip amount using the formula:
tip_amount = (tip_percentage / 100) * bill_amount - Add the tip amount to the bill amount to get the total
- Print the total amount
Note: You'll need to convert the input strings to float numbers using float(input())
Important: Use the formula exactly as written above — divide tip_percentage by 100 first, then multiply by bill_amount. Changing the order of operations (e.g., multiplying before dividing) can produce slightly different floating point results that will not match the expected output.
Try it yourself
# Step 1: Print the program title
# Step 2: Get the bill amount from user input
# Step 3: Get the tip percentage from user input
# Step 4: Calculate the tip amount
# Step 5: Calculate the total amount
# Step 6: Print the 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