1 · First steps · 8 MIN
Calculate a total
Expressions calculate values.
* multiplies numbers. Multiplication has priority over addition; parentheses make grouping explicit. A dictionary holds named values such as input["price"]. These examples use whole currency units.
A shopping receipt multiplies each item price by its quantity before calculating a total.
Read the example
price = 4 quantity = 3 print(price * quantity)
Check the expected output
12
Your challenge
Return input["price"] multiplied by input["quantity"]. Input is an object with both numbers.
Common trap
Use dictionary key access, not input.price.
Next lesson: Choose a path →