Ask 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, 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) :

+4
Answers (1)
  1. 3 June, 05:59
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers