How can I determine whether an integer is between two other integers in Python?

I’m trying to write a Python function that takes three integers as inputs and returns True if the first integer is between the other two integers (inclusive), and False otherwise. I tried using the range() function, but it seems to include only the start value and exclude the end value. Can anyone suggest an alternative method or modification to the range() function that would work?

Here’s my code so far:

def is_between(x, a, b):
    if x in range(a, b):
        return True
    else:
        return False

When I test this function with inputs (5, 2, 10), it returns True, but when I test it with inputs (10, 2, 5), it also returns True, which is incorrect. Can someone please help me identify and fix the issue in my code? And is there a better way to check if an integer is between two other integers in Python?

Any help or suggestions would be greatly appreciated! Thank you in advance.