PY-5
Calculate a Value from a Formula
Task
Write calculate_value(input_value, slope, intercept). It must calculate and
return this value:
output = slope * input_value + intercept
Here, input_value is the number supplied to the function. Multiply it by
slope, then add intercept.
Example
| Call | Calculation | Result |
|---|---|---|
calculate_value(4, 2, 1) | 2 * 4 + 1 | 9 |
calculate_value(0, 3, -2) | 3 * 0 + (-2) | -2 |
calculate_value(-3, 2, 5) | 2 * (-3) + 5 | -1 |
calculate_value(1.5, 0.2, -0.1) | 0.2 * 1.5 + (-0.1) | 0.2 |
Your implementation
Edit solution.py and keep this function name and signature:
Return the calculated number. Do not print it or ask for input.