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]
4 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]4 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
Explain how the operating system controls the software and hardware on the computer?
NemiM [27]

<em>One of the features of Operating System is </em><em>it manages and communicates with your system hardware </em><em>by means of Drivers. </em>

<em>Drivers </em><em>are special software within the OS that interacts to the hardware. Drivers uses kernel, a part of the operating system that functions intended to it. For example, when you press Ctrl and P keys on the keyboard, the kernel would recognize this command and would trigger the corresponding hardware in relation to this command. In this case, the corresponding hardware is printer. The kernel would tell the printer to print the document.</em>

8 0
3 years ago
PHP Create a for loop that initialize with the variable $i = 10 The loop outputs $i as long as $i is greater than 1 using for lo
Tanzania [10]

Answer:

The PHP code is as follows

<?php

for ($i = 10; $i>1; $i--)

{

echo $i.' ';

}

?>

Explanation:

The code is self explanatory and doesn't require comments before it can easily understood.

The program starts with a php opening tag <?php

And it ends with the closing tag ?>

The interpretation of the question is to print integer values from 10 to 1

To do this, an iteration is needed.

The above program makes use of a for loop iteration.

Analysis;

for ( -> This shows that it is a for loop iteration

$i = 10; -> Iterating variable $i is initialized to 10 (that is; printing will start at 10)

$i>1; -> Iteration is valid while $i is greater than 1 (e.g. 2,3,4...10)

$i-- -> For every Iteration, decrease $i by 1

) -> End of Iterating condition

echo $i.' '; -> This line prints the valid values of $i. In this case, the values of $i is from 10 and stops at 2

The output is as follows

10 9 8 7 6 5 4 3 2

4 0
3 years ago
At the Transport layer of the OSI, what is used to find and communicate with a particular application running on a host?
ivanzaharov [21]

Answer:

Port number

Explanation:

Port numbers are used in the identification of a particular process for forwarding some form of network message such as the internet when it reaches a server. It is usually a 16-bit integer that is unsigned and found in header that is appended to a message unit.  At the OSI transport layer, port numbers are used in searching and communicating with a specific application that is running on a host server.

4 0
4 years ago
How many of devices you identified inside the control room need to magnetism to operate
Nady [450]
The answer is 3 devices
5 0
3 years ago
Read 2 more answers
Anyone have good websites to cure boredom
Sav [38]

Answer:

cool math if its not blocked

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • An engineer is assigned the task of reducing the air pollutants being released from a power plant that generates electricity by
    9·1 answer
  • What type of device is the printer?
    13·2 answers
  • Which spreadsheet operation does a look function perform?
    5·1 answer
  • Sometimes, fourth-generation languages (4GLs) are called procedural languages
    9·1 answer
  • What does prioritization help you to do?
    12·2 answers
  • When I press F3, F4, and any of my apps on my mac why wouldn't it do anything? Do you have a way to solve this problem? When I p
    10·2 answers
  • What is a trojan horse in computer science?
    15·1 answer
  • Find true or false. A hacker is hacking software with access in sensitive information from your computer​
    9·1 answer
  • Mention how to install antivirus software in your computer, either by following the instructions given on installation CDs or we
    6·1 answer
  • Identify the type of software that should be in main memory in order to use the keyboard? *
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!