Calculate the Total Cost
Beginner · Write the code · from Python Numbers: Integers, Floats, and Math You'll Actually Use
From the lesson: Python Numbers: Integers, Floats, and Math You'll Actually Use
You're splitting a restaurant bill with three friends. The total is $85. How much does each person owe? You grab your phone calculator, but a Python programmer just types 85 / 4 and gets the answer instantly.
Read the lessonYou're buying items at a store. Calculate the total cost and print it.
Print the total in this exact format:
Total: $16.0# Item prices and quantities
notebook_price = 4.50
notebook_qty = 3
pen_price = 1.25
pen_qty = 2
# Calculate the total cost
# Print the result
More Numbers exercises
- Even or Odd CheckerBeginner
- Fix the Bug: Wrong DivisionBeginner
- Fahrenheit to Celsius ConverterBeginner
- Predict the OutputBeginner
- Compound Interest CalculatorBeginner
All Python exercises · 50 practice problems · Python Fundamentals quiz