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, 22.06.2019 09:00
Which best describes the condition under which the unicode output is the same as plain text?
Answers: 3
question
Computers and Technology, 23.06.2019 21:50
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
(, urgent need): how do i change my username
Answers: 1
question
Computers and Technology, 25.06.2019 04:20
Many prestigious universities have a system called a “legacy preference system” which is used to decide which applicants should be accepted to the university. if an applicant’s parent is an alumnus of the university, the applicant will be admitted with lower gpa and sat scores than if the parent is not an alumnus. (there is currently a lot of discussion about the fairness of this system, but universities get a lot of money from their alumni so they are unwilling to change ) your assignment for mp2 is to implement a computerized system like this for a very small prestigious university. the university has two schools, liberal arts and music, each with their own criteria for accepting students. your program must read in certain information about an applicant and print a message saying whether the applicant should be accepted or not.
Answers: 2
You know the right answer?
Given the code that reads a list of integers, complete the number_guess() function, which should cho...
Questions
question
Biology, 08.11.2020 05:40
question
English, 08.11.2020 05:40
question
Mathematics, 08.11.2020 05:40
question
Mathematics, 08.11.2020 05:40
question
Mathematics, 08.11.2020 05:40
Questions on the website: 13722359