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
Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
SIZIF [17.4K]

lst = input().split()

lst.pop(0)

w = lst[-1]

lst.pop(-1)

newlst = [int(x) for x in lst if int(x) <= int(w)]

print(newlst)

This works for me. Best of luck.

6 0
3 years ago
Is this correct? I say its B, but my friend says its D.
kari74 [83]

Answer:

b

Explanation:

4 0
3 years ago
Read 2 more answers
Select the correct answer.
miv72 [106K]

Answer: Format

Explanation: My head

3 0
3 years ago
Read 2 more answers
This isn't a homework question but rather a technological problem. I connected my device to the motherboard but it will not dete
Helen [10]
Re start the computer again
5 0
4 years ago
Read 2 more answers
Explain how rotary dialing sends digits to the switch.
kozerog [31]

A rotary dial telephone was a popular type of phone design throughout the 20th century. ... This causes the dial to return to its starting position due to an internal recoil spring, while simultaneously generating a series of electrical pulses that interrupt the flow of current on the telephone's line.
7 0
3 years ago
Other questions:
  • (Financial application: compound value) Suppose you save $100 each month into savings account with an annual interest rate of 5%
    6·1 answer
  • What is a common method for testing a spot weld?
    13·1 answer
  • Do you think you would share hardware or software resources in a LAN and why?
    14·1 answer
  • By default, the hyperlink will display the text in the hyperlink itself, such as the web URL. How can this behavior be modified?
    12·1 answer
  • What are the advantages of using an external style sheet?
    9·1 answer
  • What kind of a bug is 404 page not found
    10·2 answers
  • Which business application uses electronic tags and labels to identify objects wirelessly over short distances?
    8·1 answer
  • Given an array a, write an expression that refers to the first element of the array .
    5·1 answer
  • Why do ineed to upgrade to see answers isnt it enough adds
    15·2 answers
  • Please tell me which ones go into which categories no files!!
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!