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 does an author develop a charterer in a story
kakasveta [241]
Ways in which an author develops a character are with physical description, behavior, insight into the character's thought processes through dialogue or narration, and insight through the opinions of other characters in a story.
6 0
3 years ago
Which supercontinent is thought to have formed about 1 billion years ago and to have included most of Earth's land masses?
riadik2000 [5.3K]
C (Pangaea)

Dinosaurs lived on Pangaea
7 0
3 years ago
Why can I not answer questions on Brainly? Do i have to upgrade my plan?
dimulka [17.4K]

Answer:

may any technical issue which creates this.. upgrade is not necessarily

4 0
3 years ago
Read 2 more answers
Which menu selection under accessories will open a dos like window
Mekhanik [1.2K]
The answer is :Command prompt
6 0
4 years ago
An ATM card is used on January 24 to withdraw cash. What is the balance after this transaction
Nezavi [6.7K]
The balance is what ever money is left in the account
4 0
3 years ago
Read 2 more answers
Other questions:
  • How can i appear offline without fb messenger saying "last active 1 minute ago"?
    5·1 answer
  • Which computer program can you use to write, edit, print, and perform any modifications to a document?
    13·2 answers
  • Which decision maker is the most desirable to have in a workplace
    9·1 answer
  • If a person was on board a hypersonic airplane what do you think they would be able to see as they look out a window looking in
    13·2 answers
  • Write a function called which_vowels_present that takes a single string parameter. Complete the function to return a list of str
    6·1 answer
  • A _____________ is a piece of information sent to a function.<br> The answer is parameter :)
    12·1 answer
  • What is the navigation aid that shows users the path they have taken to get to a web page located within a website?
    12·1 answer
  • Give the full form of http​
    5·1 answer
  • Which of the following can help organize your email messages? Select all that apply.
    13·2 answers
  • Some operating systems add the command interpreter to the kernel .what will be the justification for this design principle?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!