1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Arada [10]
3 years ago
6

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 The whole point of this question is to get you to read the random module documentation.

Computers and Technology
1 answer:
sladkih [1.3K]3 years ago
6 0

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.

You might be interested in
Which of the following actions is most likely to raise legal or ethical concerns?
zavuch27 [327]

Answer:

arson, kidnapping, gun fighting

Explanation:

7 0
2 years ago
Read 2 more answers
If you cannot see _______________, you are in the truck driver's blind spot and cannot be seen.
AlladinOne [14]

Answer:

C

Explanation:

It's the right answer because it's true. The other answers are wrong because seeing the reflection or the front will not put you in the blind spot.

3 0
3 years ago
It is not important to type '=' before a formula or a function
Papessa [141]

Answer:

no

Explanation:

because it designates the sum or total

8 0
2 years ago
A key or combination of keys that complete an action more efficiently than using the mouse is called a(n) keyboard shortcut.
andreev551 [17]
The answer to your question is true
6 0
3 years ago
Which skill type refers to the ability to interact and communicate effectively with people?
sukhopar [10]
Softskills refer to the ability to interact and communicate effectively with people.
3 0
3 years ago
Other questions:
  • _____ is a method of delivering software, in which a vendor hosts the applications, and customers access these applications over
    10·1 answer
  • How do you change the slide layout?
    6·2 answers
  • A technician with a PC is using multiple applications while connected to the Internet. How is the PC able to keep track of the d
    8·2 answers
  • A restaurant has a case type that allows customer to book the dining room for events. Customers provide basic information includ
    7·1 answer
  • A mobile device you are troubleshooting is experiencing a sharp decrease in performance after an hour of operation. The user pow
    9·1 answer
  • Your program will search for prime numbers. You will first ask the user for the range of values to search, and use for loops to
    6·1 answer
  • What is displayed on the console when running the following program?
    5·1 answer
  • If I'm screen sharing and I plug in a HDMI, will it screen share what the HDMI is plugged into, and can you talk at the same tim
    11·1 answer
  • I'm getting an iphone xr today. what should i do 1st? Any cool fetures? i have a iphone 6 now so its a pretty big upgrade
    13·2 answers
  • What is lossless compression
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!