Ask Question
23 July, 00:56

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. 23 July, 01:20
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers