Skip to the content

Does it fall in range?

Problem

The bakery oven has to stay between two temperatures. Write a function that takes value, low and high, and returns true when the value falls inside that range.

Both ends count as inside: if low is 10 and high is 20, then 10 and 20 are in too. The numbers can be negative or have decimals.

Examples

  • 15, 10, 20 → true

  • Too high

    25, 10, 20 → false

  • Too low

    5, 10, 20 → false

Besides these, the challenge has hidden tests that are revealed when you submit your solution.

You start with this

Python

def in_range(value, low, high):
    pass

JavaScript

function inRange(value, low, high) {
}
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →