Answer:
import random
def ran(lower_bound, upper_bound):
return random.randrange(lower_bound, upper_bound)
print(ran(3, 8))
Explanation:
The programming language used is python.
Modules are imported using the import keyword. In the first line the random module is imported.
A function ran is defined and it has two parameters, lower and upper bound that wll be passed to the function from random module.
The random module is a module that is used to generate random numbers, it is a very common module in programming, some of the popular functions in the module are random.randint and random.randrange. There are several other functions but these are the most common. the randint(a, b) takes two arguments and returns a random integer between the two arguments.
randrange(start, stop, step); It can take up to three arguments but has only compulsory argument that must be given for it not to generate an error and that is the stop.
when only the stop is defined, it assumes the start as zero and creates a range from 0 - stop and returns a random number within that range.
When start and stop arguments are given, it returns a number within the range of start - stop.
Start and stop must be given for there to be a step, if the step is given, it means the array containing the range of numbers will skip a step after each number.
The program makes use of the random.randrange(start, stop) and the upper and lower bounds are passed as its arguments.
Finally, the function is called and its return value is printed to the screen.