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]
2 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]2 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
Analyze the following code.
vazorg [7]

Answer:

The correct answer for the given question is "The program has a runtime NullPointerException because test is null while executing test.x"

Explanation:

In this code their is run time exception will occur in Main method i.e "java.lang.NullPointerException "because the object of the Test class i.e test will initialized by "null" .So on executing the statement test.x  it gives an Runtime Exception.The "NullPointerException" can occur if we assign the object to the "null" value that why it produce an java.lang.NullPointerException

8 0
3 years ago
tion. 6. A step occasionally required to repair damaged relationships is O A. looking at the problem from the other person's poi
Marta_Voda [28]
The answer to this question is b that's the answer
5 0
3 years ago
I need help please :((((<br> I need it in python
Bezzdna [24]
Take this one step at a time. Your teacher has given you the code for step 1. Now write step 2. Then 3, and so on.

For step 2: if you're using Python v2.x you'd use a line like

guess = int( raw_input( "Take another guess: " ) )

For Python v3.x it would be:

guess = int( input( "Take another guess: " ) )

Break it down into small pieces, it's not a complicated assignment.
7 0
3 years ago
____ refers to the ability of one computing device (a desktop computer, portable computer, or smartphone, for example) on a netw
SCORPION-xisa [38]
<span>Presence technology is the answer</span>
8 0
3 years ago
My computer likes to disconnect every 3 or 5 minutes a lot when I turn it on, Is there any solution for this?
stira [4]

Answer:

RESTART IT!!! also check if its charged and look up problems with that model

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • Categories of general purpose application software and examples each​
    13·1 answer
  • What are the benefits of organizing your thoughts before you begin your speech
    14·1 answer
  • 3) An example of interactive web page is<br>​
    11·1 answer
  • Orifice tubes are A. coded in American models only. B. coded by number for easy identification. C. similarly but not exactly siz
    12·1 answer
  • What are invoices? A. Documents that convey a company's liabilities B. Documents that convey how much a company was earning and
    5·2 answers
  • What is an antispamming approach where the receiving computer launches a return attack against the spammer, sending email messag
    9·2 answers
  • Which element can be changed using the Print pane? Check all that apply.
    9·2 answers
  • 2 4.1.2 Quiz: Information Systems and Business Planning
    11·1 answer
  • 1 point
    13·1 answer
  • your manager asks you to set up a secure network connection at a remote site to move over some backups which protocol would you
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!