PY-4

Classify One Reading

  • Easy
  • Conditions and Functions
  • Python

Task

Write classify_reading(value, lower, upper). It must return one of three labels:

  • return "low" when value is less than lower;
  • return "in range" when value is between the two boundaries, including either boundary;
  • return "high" when value is greater than upper.

You may assume that lower <= upper.

Example

For the interval from 5 through 10, the function must behave as follows:

CallResult
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.