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
gizmo_the_mogwai [7]
3 years ago
9

Write a program that takes a positive integer argument N, and prints out the average, minimum, and maximum (in that order) of N

uniform random numbers that it generates. Note that all three statistics should be over the same sequence of N random numbers python
Computers and Technology
1 answer:
Flura [38]3 years ago
7 0

Answer:

from random import seed, choices

from statistics import mean

number = int(input("Enter integer number: "))

if number > 0:

   try:

       data = range(number+1)

       # to generate a pseudo-random number list.

       seed(10)

       # you can also use: num_list = [random.randint(0, number+1) for i in data]

       num_list = choices(data, k=len(data))

       print(num_list)

       mean_val = round(mean(num_list), 2)

       min_val = min(num_list)

       max_val = max(num_list)

   except ValueError:

       print("Must be an integer value.")

print('Avg number: {}\nMax number: {}\nMin number: {}'.format(mean_val, max_val, min_val))

Explanation:

To generate random items in a list of integers, the random choices method is used and a sequence is passed as an argument. The average, maximum, and minimum number of the list is calculated and displayed.

You might be interested in
Which of the following job tities is held by a person working at a global food distribution ?
Ksivusya [100]
Hi! Please give me Brainliest! Thanks!
6 0
3 years ago
What is the binary conversion of 179.187.223.21?
Lemur [1.5K]

Explanation:

I hope its the correct answer i'm not sure!

6 0
3 years ago
Read 2 more answers
Jo.in Goo.gle meet the code/rhk-rvet-tdi​
horrorfan [7]

Answer:

nah

Explanation:

cuz ion wanna

8 0
3 years ago
Which of the following is not a step that must occur with every correctly working loop?
goblinko [34]

Answer:

b) Set the loop control value equal to a sentinel during each iteration.

Explanation:

Sentinel in the loops is the constant value that is used to stop the loop. So in each iteration, if you set the loop control value to the sentinel. The loop will stop working or the sequence of compiling will break out of the loop.

So setting the loop control value to the sentinel is not a correct step for properly working of the loop.

7 0
4 years ago
Read 2 more answers
What is the name of the national outreach project?
bagirrra123 [75]

Answer:

FCCLA should be the answer.

Explanation:

5 0
3 years ago
Other questions:
  • Click _______ to add a new column to a table.
    6·2 answers
  • The following function open_file() opens a file called 'example.txt' and returns the file pointer. This function is called withi
    12·1 answer
  • Which of the following is an example of a consumer
    14·2 answers
  • How to create PowerPoint presentation computer networking using visual diagrams
    9·1 answer
  • Package Newton’s method for approximating square roots (Case Study 3.6) in a function named newton. This function expects the in
    7·1 answer
  • Two methods defined within a class are shown below. What can be said about the variable x used in both methods?
    10·1 answer
  • A quarter of adults have a tablet and half of them own a smartphone.<br> a. True<br> b. False
    7·2 answers
  • Please help it would mean a lot.
    7·2 answers
  • Why would you browse by entering a URL rather than use a link in a Web page
    15·1 answer
  • The temperature at 8 AM was 44°F and at noon it was 64°F. what was the percent of change from 8 AM to noon?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!