Printing ranges of numbers using if/else statements

I have to write a problem that take two integers as input from the user and print the range of numbers between them within square brackets. Print an increasing sequence if the first number is smaller than the second. Print a decreasing sequence if the second is smaller than the first. If the numbers are equal then one of them should be printed.

Example:

Input: 2 and 7

Output: [2, 3, 4, 5, 6, 7]

Input: 3 and -2

Output: [3, 2, 1, 0, -1, -2]

Input: 3 and 3

Output: [3]

Any help would be greatly appreciated. Thanks