Python practice: Arithmetic & Mathematical Operations
Chapter 3 · 8 questions · free to solve
Question 1 · easy
Basic four arithmetic operations
Solve it in your browserGiven
a = 20andb = 4, print their sum, difference (a - b), product (a * b), and quotient (a / b) on separate lines:Question 2 · easy
Floor division for packaging
Solve it in your browserAn order contains
53units. Shipping cartons hold12units each. Use//to compute how many full cartons can be packed and print the result:Question 3 · easy
Modulo for leftover inventory
Solve it in your browserUsing
units = 53andcarton_size = 12, calculate the remaining units that do not fill a complete carton using%and print the result:Question 4 · easy
Compound annual return with **
Solve it in your browserCalculate future value:
principal = 1000,rate = 1.10,years = 3. Multiplyprincipal * (rate ** years)and print the result:Question 5 · easy
Parentheses control precedence
Solve it in your browserPrint the result of
(10 + 20) * 2on line 1, and10 + 20 * 2on line 2 to show precedence difference:Question 6 · easy
Round decimal prices
Solve it in your browserGiven
price = 49.9567, round it to 2 decimal places usinground()and print the rounded result:Question 7 · easy
Average basket size
Solve it in your browserThree store branches made sales:
store_a = 120,store_b = 150,store_c = 180. Compute the average sales and print it:Question 8 · medium
Discount percentage calculation
Solve it in your browserGiven
list_price = 2500andsale_price = 2000, computediscount_pct = (list_price - sale_price) / list_price. Printdiscount_pct:
These questions are free.
Make a free account to solve them, with instant checking and an AI tutor for hints.
Start free