PY-4
Classify One Reading
Task
Write classify_reading(value, lower, upper). It must return one of three
labels:
- return
"low"whenvalueis less thanlower; - return
"in range"whenvalueis between the two boundaries, including either boundary; - return
"high"whenvalueis greater thanupper.
You may assume that lower <= upper.
Example
For the interval from 5 through 10, the function must behave as follows:
| Call | Result |
|---|---|
classify_reading(3, 5, 10) | "low" |
classify_reading(5, 5, 10) | "in range" |
classify_reading(7, 5, 10) | "in range" |
classify_reading(10, 5, 10) | "in range" |
classify_reading(12, 5, 10) | "high" |
The lower and upper boundaries both belong to the interval.
Your implementation
Edit solution.py and keep this function name and signature:
Return the required string. Do not print the result or ask for input.