subject

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:
32 45 48 80
the output is:
32 is too low. Random number was 80.
45 is too high. Random number was 30.
48 is correct! 80 is too low.
Random number was 97.

# TODO: Import the random module
import random
def number_guess(num):
# TODO: Get a random number between 1-100
# TODO: Read numbers and compare to random number

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)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:00
In a cellular network each cell is controlled by a tower what are these towers called?
Answers: 3
question
Computers and Technology, 22.06.2019 15:10
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
You know the right answer?
Given the code that reads a list of integers, complete the number_guess() function, which should cho...
Questions
question
Mathematics, 21.07.2019 03:31
question
Mathematics, 21.07.2019 03:31
Questions on the website: 13722362