easy +8 pts

Between inclusive

Check if a number lies between two given endpoints, inclusive.

Write a function `is_between_inclusive(value: float, low: float, high: float) -> bool` that returns `True` if `value` is between `low` and `high` inclusive, and `False` otherwise. You may assume `low <= high`. The bounds are inclusive, so if `value` equals `low` or `high`, the result is `True`. Your function should work with integers and floats.

Constraints

Inputs are real numbers. You may assume `low <= high`. Time complexity O(1), space complexity O(1).

Example

>>> is_between_inclusive(5, 1, 10)
True
>>> is_between_inclusive(0, 1, 10)
False
>>> is_between_inclusive(1, 1, 10)
True
>>> is_between_inclusive(10, 1, 10)
True
8 points ~10 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Use two comparison operators combined with `and`.
Check both `value >= low` and `value <= high`.
Because `low <= high`, you don't need to swap anything.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.