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
Consider sending a 2400-byte datagram into a link that has an mtu of 700 bytes. suppose the original datagram is stamped with th
Feliz [49]

Explanation:

Let, DG is the datagram so, DG= 2400.

Let, FV is the Value of Fragment and F is the Flag and FO is the Fragmentation Offset.

Let, M is the MTU so, M=700.

Let, IP is the IP header so, IP= 20.

Let, id is the identification number so, id=422

Required numbers of the fragment = [\frac{DG-IP}{M-IP} ]

Insert values in the formula = [\frac{2400-20}{700-20} ]

Then,        = [\frac{2380}{680} ] = [3.5]

The generated numbers of the fragment is 4

  • If FV = 1 then, bytes in data field of DG= 720-20 = 680 and id=422 and FO=0 and F=1.
  • If FV = 2 then, bytes in data field of DG= 720-20 = 680 and id=422 and FO=85(85*8=680 bytes) and F=1.
  • If FV = 3 then, bytes in data field of DG= 720-20 = 680 and id=422 and FO=170(170*8=1360 bytes) and F=1.
  • If FV = 4 then, bytes in data field of DG= 2380-3(680) = 340 and id=422 and FO=255(255*8=2040 bytes) and F=0.

3 0
4 years ago
Research shows that a passive close to a cover letter leads to more interviews. Please select the best answer from the choices p
Alchen [17]
The answer is False.

According to research, a passive close doesn't lead your cover letter to have more interviews. In writing the closing part of your cover letter, it is easy to have a passive sentence but it sounds like less confidence to the employer. The last part of the cover letter should contain strong content to give an impression to the person who reads.
6 0
3 years ago
Read 2 more answers
Write a pseudocode to read 10 integer numbers and find the largest number, you need to use loop in your answer.
Sophie [7]
  1. # Algorithm to find the number of integers greater than 10 in a list
  2. list = read(list of integers)
  3. n = len(list)
  4. count = 0
  5. For i = 1 to n
  6.    If list[i] > 10:
  7.        count = count + 1
  8.    Endif
  9. End
  10. Return count
<h3>Explanation:</h3>

Then the length of the list is stored in a variable n. A variable count to store the number of integers more significant than 10 is initialized to 0.

  • Then, a for-loop is used to iterate over the list. A for-loop is used in this case because every element of the inventory needs to be checked for a value greater than 10.
  • In each iteration of the for-loop, the value at the index of the list is checked. If the value is greater than 10, then the counter variable count is incremented by 1.
  • The iterations continue till the for-loop ends. At this point, the variable count will be the number of integers greater than 10.
  • Note that in case the list does not have any number greater than 10, then the count variable will be 0.

To learn more about it, refer

to brainly.com/question/25311149

#SPJ4

3 0
2 years ago
Objects of the calculator class require no additional information when created. define an object named calc, of type calculator.
Grace [21]

Answer

calculator calc;

Explanation

An object is an instance of a class. And a class is what defines or describes the behavior or the state of the object of its type. When a class is defined no memory is allocated until when an object is created memory is allocated.

4 0
3 years ago
Read 2 more answers
Why do people yeet yeet and ree
DiKsa [7]

Answer:

Cause they are trying to be annoying

Explanation:

Something is wrong with them :)

8 0
3 years ago
Read 2 more answers
Other questions:
  • This provides an easy method for workers to use their computers.
    5·1 answer
  • __________________ are evaluations of a network
    6·1 answer
  • What cable should i be using to connect my android tablet to the pc?
    13·2 answers
  • When starting a new job, the form you complete to determine how much tax to withhold from your paycheck is called the
    9·1 answer
  • In order to create a multi-line comment, what symbol do you use?
    14·1 answer
  • Please answer <br><br> Steps 1-6 <br><br> Visual basics
    7·1 answer
  • Enthusiasm codehs 7.6.4 Write a function called add_enthusiasm that takes a string and returns that string in all uppercase with
    15·1 answer
  • Plz plz plz help me with me
    14·2 answers
  • Explain the role and importance of ict in daily life ?​
    7·1 answer
  • Who is the founder of C language?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!