lesson

Is it in range?

objective: debugging exercise · comparisons & boundaries · easy
Task type: fix broken code

in_range(n, low, high) should return True when n is low, high, or anywhere between them. Right now the endpoints themselves don't count.

fix this code so it matches

in_range(5, 1, 10) is True. in_range(15, 1, 10) is False. in_range(1, 1, 10) is True (the low end counts). in_range(10, 1, 10) is True (the high end counts).

  • Passes the visible tests
  • Passes the hidden tests (edge cases)
Go deeper

Lesson resources

Finding resources…
in_range.pyattempt 0
1
2
3