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 Ribbon contains the paragraph attributes?<br><br> Home<br> Insert<br> Review<br> View
Lemur [1.5K]
The Home ribbon contains the Paragraph attributes
7 0
3 years ago
Read 2 more answers
The ____ section of the project plan should describe the major project functions and activities and identify those individuals w
harkovskaia [24]

Answer:

Option(c) is the correct answer to the given question .

Explanation:

The Project responsibilities section is responsible of the planning of project.

Following are the Roles of the Project Responsibilities

  • To check the objective of the project goals.
  • Works with customers and  to define and meet client needs and the overall objective .
  • Cost estimation and expenditure production of the project
  • Ensure the fulfillment of the client .Analysis and enterprise risk management. and Tracking the progress of project.

All the others options are not responsible of the planning of project that's why Option(c) is the correct answer .

7 0
3 years ago
How are the current and resistance related when the voltage of a circuit is constant?
andreev551 [17]
Since resistance and current are inversely proportional, when the resistance doubles, the current is cut in half.
5 0
2 years ago
Read 2 more answers
Create a class Str that subclasses str. Add a method to the subclass that checks if the string does not start with a given strin
Stolb23 [73]

Answer:

#include <iostream>

using namespace std;

class Str{  ///baseclass

   public :

   string super_str;

   string getStr()

   {

       return super_str;

   }

   void setStr(string String)

   {

       super_str=String;

   }

};

class str : public Str{   //inheriting Str publicly

   public :

       string sub_str;

       string getstr()

       {

           return sub_str;

       }

       void setstr(string String)

       {

           sub_str=String;

       }

       bool notstartswith()

       {

           int n=sub_str.length();   //to find length of substr

           bool flag=false;

           for(int i=0;i<n;i++)     //Loop to check beginning of Str

           {

               if(super_str[i]!=sub_str[i])

               {

                   flag=true;

                   break;

               }

           }

           return flag;

       }

};

int main()

{

   str s;    //object of subclass

   s.setStr("Helloworld");  

   s.setstr("Hey");

   if(s.notstartswith()==1)     //checking if str is substring of Str

       cout<<"Str does not start with str";

   else

       cout<<"Str starts with str";

   return 0;

}

OUTPUT :

Str does not start with str

Explanation:

Above program is implemented the way as mentioned. for loop is being used to check the beginning of the str starts with substring or not.

3 0
3 years ago
Which of the following is the MOST important consideration when planning your budget?
Sladkaya [172]
C.budget for fixed expenses before flexiable expenses 

3 0
3 years ago
Read 2 more answers
Other questions:
  • Computers are said to use binary data because all computer data is simply a series of Os and 1s.
    10·1 answer
  • In the Remote Access Domain, if private data or confidential data is compromised remotely, you should set automatic blocking for
    5·1 answer
  • Question 1<br> a node is.<br> •a sever<br> A Cell Phone<br> A Laptop<br> a device on a network
    13·1 answer
  • You are trying to log in to your old computer, and can't remember the password. You sit for hours making random guesses... I'm s
    10·1 answer
  • 2.36 LAB: Warm up: Variables, input, and casting (1) Prompt the user to input an integer, a double, a character, and a string, s
    12·1 answer
  • Darcy was working on a presentation on playing chess. Because she chose the Checkerboard animation for her slide title, she had
    15·2 answers
  • Which symbol would be used in a flowchart to represent a connection to another part of the flowchart
    5·1 answer
  • How would you want to change the copyright laws?
    11·1 answer
  • put together a shopping list of items that a first responder should always have at immediate disposal in a field kit. Using curr
    11·1 answer
  • Q.3.1 Explain why devices on a network need addresses. (5)​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!