Ask Question
11 August, 23:59

In the function below, use a function from the random module to return a random integer between the given lower_bound and upper_bound, inclusive. Don't forget to import the random module (before the function declaration).

For example, return_random_int (3, 8) should random return a number from the set: 3, 4, 5, 6, 7, 8.

length. py

def return_random_int (lower_bound, upper_bound) :

+2
Answers (1)
  1. 12 August, 02:30
    0
    import random

    def return_random_int (lower_bound, upper_bound):

    return random. randrange (lower_bound, upper_bound)

    print (return_random_int (3, 8))

    Explanation:

    Import the random module

    Create a function called return_random_int takes two parameters, lower_bound and upper_bound

    Return a number between lower_bound and upper_bound using random. range ()

    Call the function with given inputs, and print the result
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “In the function below, use a function from the random module to return a random integer between the given lower_bound and upper_bound, ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers