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
RUDIKE [14]
3 years ago
6

Write a program that prompts the user to enter a series of numbers between 0 and 10 asintegers. The user will enter all numbers

on a single line, and scores will be separatedby spaces. You cannot assume the user will supply valid integers, nor can you assumethat they will enter positive numbers, so make sure that you validate your data. You donot need to re-prompt the user once they have entered a single line of data. Once youhave collected this data you should compute the following: • The largest value • Thesmallest value • The range of values • The mode (the value that occurs the most often) •A histogram that visualizes the frequency of each number Here’s a sample running of theprogram.
Computers and Technology
1 answer:
Anna71 [15]3 years ago
7 0

Answer:

The program in Python is as follows:

import collections

from collections import Counter

from itertools import groupby

import statistics

str_input = input("Enter a series of numbers separated by space: ")

num_input = str_input.split(" ")

numList = []

for num in num_input:

         if(num.lstrip('-').isdigit()):

                   if num[0] == "-" or int(num)>10:

                             print(num," is out of bound - rejecting")

                   else:

                             print(num," is valid - accepting")

                             numList.append(int(num))

         else:

                   print(num," is not a number")

print("Largest number: ",max(numList))

print("Smallest number: ",min(numList))

print("Range: ",(max(numList) - min(numList)))

print("Mode: ",end = " ")

freqs = groupby(Counter(numList).most_common(), lambda x:x[1])

print([val for val,count in next(freqs)[1]])

count_freq = {}

count_freq = collections.Counter(numList)

for item in count_freq:

         print(item, end = " ")

         lent= int(count_freq[item])

         for i in range(lent):

                   print("#",end=" ")

print()

Explanation:

See attachment for program source file where comments are used as explanation. (Lines that begin with # are comments)

The frequency polygon is printed using #'s to represent the frequency of each list element

You might be interested in
How do lung and heart work together
Vinil7 [7]
Heart is attached to the lungs by the pulmonary artery and vein the artery carries deoxygenated blood to the pulmonary circuit (lungs) the lungs have a gas exchange and the deoxygenated blood goes back to the heart via the pulmonary vein.<span />
8 0
3 years ago
Which statement, if any, about Boolean is false?
Vladimir79 [104]

Answer:

A.

Explanation:

7 0
3 years ago
Knowing how to use your learning style to study is not important.
qaws [65]

False. It helps u learn better if u use ur learning style to study

3 0
3 years ago
I WILL GIVE BRAINLIEST!<br> PLEASE HELP ME DUE!!!
Mandarinka [93]

Answer:

AX=B

Explanation:

6 0
3 years ago
The database management system is a program used to create, process, and administer a database.
omeli [17]
The Answer is True.
7 0
3 years ago
Other questions:
  • When using a template to compose a memorandum which key on the keyboard moves the cursor to the next field
    15·1 answer
  • Describe network in terms of the class computer lab
    9·1 answer
  • What is the purpose of the operating systems management function
    5·1 answer
  • What output is produced by
    10·1 answer
  • Question 7 (1 point)<br> Increasing hue levels means increasing saturation.<br> True<br> False
    11·1 answer
  • A ____ resembles a circle of computers that communicate with each other.
    14·1 answer
  • 19 dollar fortnite giftcard who wants it
    15·2 answers
  • I need help please !!!!
    12·1 answer
  • A program with a graphical user inter-face for displaying HTML files, used to navigate the World Wide Web.
    8·1 answer
  • Which source would provide the best way to find valid information about climate change
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!