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
natulia [17]
3 years ago
6

Given the code that reads a list of integers, complete the number_guess() function, which should choose a random number between

1 and 100 by calling random.randint() and then output if the guessed number is too low, too high, or correct. Import the random module to use the random.seed() and random.randint() functions. random.seed(seed_value) seeds the random number generator using the given seed_value. random.randint(a, b) returns a random number between a and b (inclusive). For testing purposes, use the seed value 900, which will cause the computer to choose the same random number every time the program runs. Ex: If the input is:
Computers and Technology
1 answer:
Cerrena [4.2K]3 years ago
5 0

Answer:

see explaination

Explanation:

import random

def number_guess(num):

n = random.randint(1, 100)

if num < n:

print(num, "is too low. Random number was " + str(n) + ".")

elif num > n:

print(num, "is too high. Random number was " + str(n) + ".")

else:

print(num, "is correct!")

if __name__ == '__main__':

# Use the seed 900 to get the same pseudo random numbers every time

random.seed(900)

# Convert the string tokens into integers

user_input = input()

tokens = user_input.split()

for token in tokens:

num = int(token)

number_guess(num)

You might be interested in
Which statement describes borders and shading ?
Marina CMI [18]

Answer: Borders are rules you can add to any or all of the four sides of a paragraph. Shading is the color or artistic design you use as background for a paragraph. Borders and shading are formatting tools for enhancing text, paragraphs, table cells or frames.

3 0
3 years ago
Universal Containers requires that all users add at least one Product Option from the Maintenance Feature to a bundle.
zmey [24]

Answer

Set the Max Options for “Maintenance” to be one. Set the Min Options to one & Max Options to two for “Support”.

Explanation:

the Admin set up these requirements for the user using Set the Max Options for “Maintenance” to be one. Set the Min Options to one & Max Options to two for “Support”. Since users must select at least one and no more than two Product Options from the Support Feature and Product Option from the Maintenance Feature to a bundle.

6 0
3 years ago
Which of the following is caused by wind erosion?
laila [671]
I'm not sure, but I think that  C : topsoil removal <span>is caused by wind erosion. I hope it helps</span>
7 0
3 years ago
Read 2 more answers
TV show information can either keep track of the number of viewers per show or the name of a show. Information is kept in a file
Elza [17]

Answer:

See explaination for Program source code.

Explanation:

The program source code below.

#include <iostream>

#include <fstream>

#include <vector>

using namespace std;

class Show

{

private:

string title;

int viewers;

public:

Show()

{

this->title = "";

this->viewers = 0;

}

Show(string title, int viewers)

{

this->title = title;

this->viewers = viewers;

}

string getTitle(){ return this->title; }

int getViewers(){ return this->viewers; }

};

int main()

{

vector<Show> shows;

vector<string> titles;

vector<int> viewers;

ifstream inFile1("file1.txt");

ifstream inFile2("file2.txt");

string line1, line2;

if(!inFile1.is_open() || !inFile2.is_open())

{

cout << "Either of the files could not be found!\n";

exit(0);

}

getline(inFile1, line1);

if(line1.compare("Show") == 0)

{

while(getline(inFile1, line1))

{

titles.push_back(line1);

}

inFile1.close();

}

getline(inFile2, line2);

if(line2.compare("Viewer") == 0)

{

while(getline(inFile2, line2))

{

viewers.push_back(stod(line2));

}

inFile2.close();

}

for(int i = 0; i < titles.size(); i++)

{

shows.push_back(Show(titles[i], viewers[i]));

}

// display all the show details

cout << "\nALL SHOWS:\n----------\n";

for(Show show : shows)

{

cout << "Title: " << show.getTitle() << ", Number of viewers: " << show.getViewers() << endl;

}

cout << endl;

return 0;

}

See attachment for output

3 0
3 years ago
When would you use an omnidirectional microphone?
alina1380 [7]

Answer:

when it is a windy day and you want to reduce the sound of the wind in the recording

5 0
3 years ago
Other questions:
  • A(n) ____________________ defines the number and type of daemons that are loaded into memory and executed by the kernel on a par
    12·1 answer
  • Sniffing network and wireless traffic, intercepting bluetooth traffic, and even using equipment to remotely pull information fro
    12·1 answer
  • ____________ hackers break into systems legally for non-malicious reasons such as to test system security vulnerabilities
    7·2 answers
  • Can you get financial aid with average grades
    15·1 answer
  • What areas do you need to grow your knowledge in to understand your financial future?
    12·1 answer
  • What is the gear ratio?
    12·1 answer
  • 2. Used to drive in or remove screws that fasten electrical wires or other electrical accessories. A. Pliers C. Screwdrivers B.
    15·1 answer
  • Which memory can be removed from motherboard? RAM OR ROM?​
    7·1 answer
  • Now that you have learned the basics of acquiring relevant information through research, it's time to put your skills to work.
    7·1 answer
  • How has 5G become more energy efficient?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!