logo

What is between?

Complete the function that takes two integers (a, b, where a < b) and return an array of all integers between the input parameters, including them.


My code:

def between(a,b):
    numbers_list = []
    if a > b:
        for numbers in range (b, a + 1):
            numbers_list.append(numbers)    
    elif b > a:
        for numbers in range (a, b + 1):
            numbers_list.append(numbers)            
    return numbers_list
                           
                    


And that's the best solution among all users:

def between(a,b):
    return list(range(a,b+1))