Concept Flow - Math-related operations
Start
Input numbers
Choose operation
Perform operation
Store result
Output result
End
This flow shows how math operations take inputs, perform calculations, and produce results step-by-step.
Jump into concepts and practice - no test required
a = 10 b = 3 sum = a + b product = a * b result = sum - product
| Step | Variable | Operation | Value After Operation |
|---|---|---|---|
| 1 | a | Assign 10 | 10 |
| 2 | b | Assign 3 | 3 |
| 3 | sum | Add a + b | 13 |
| 4 | product | Multiply a * b | 30 |
| 5 | result | Subtract sum - product | -17 |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | After Step 4 | After Step 5 |
|---|---|---|---|---|---|---|
| a | undefined | 10 | 10 | 10 | 10 | 10 |
| b | undefined | undefined | 3 | 3 | 3 | 3 |
| sum | undefined | undefined | undefined | 13 | 13 | 13 |
| product | undefined | undefined | undefined | undefined | 30 | 30 |
| result | undefined | undefined | undefined | undefined | undefined | -17 |
Math-related operations in Python: - Use +, -, *, / for addition, subtraction, multiplication, division - Assign results to variables - Operations follow order of execution - Variables store intermediate and final results - Example: result = (a + b) - (a * b)
% returns the remainder after division of one number by another./ returns the quotient, exponent ** raises to power, and multiplication * multiplies numbers.** to calculate powers, so 3 ** 4 means 3 to the power 4.3 ^ 4 is bitwise XOR, pow(3, 4) is a function but not syntax operator, 3 ^^ 4 is invalid syntax.result = 10 % 3 print(result)
result, which is 1.value = 5 ** print(value)
** needs two numbers, but here only one number (5) is given before it.import math radius = 7 area = ? print(area)
math.pi for π and radius ** 2 for radius squared, so math.pi * (radius ** 2).