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
I forgot to tell it’s on Roblox for those who play and wanted to be friends and new ppl username is mosarider489
never [62]

Answer:.

Explanation:

.

8 0
2 years ago
Read 2 more answers
Python code 100 Random Numbers (twice)
Leona [35]

import random

i = 1

while i <= 100:

   print("#"+str(i)+": "+str(random.randint(1,100)), end=", ")

   i+=1

print()

i = 1

while i <= 100:

   print("#"+str(i)+": "+str(random.uniform(1,100)), end=", ")

   i += 1

I hope this helps!

8 0
2 years ago
Blackbaud is a company that supplies services and software designed for nonprofit organizations. Which type of e-commerce websit
natka813 [3]

Explanation:

Blackbaud's software products are specially designed to support the unique needs of nonprofit and social good organizations.

Explore our software solutions that can help you advance your organization's mission.

3 0
3 years ago
Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a ____ wh
mart [117]
Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a subdirectory whose records are filenames that point to files.
3 0
3 years ago
Modify the code below to do the following:
Kitty [74]

Answer:

The code is appropriately given below with comments for better understanding

Explanation:

#include <linux/init.h>

#include <linux/module.h>

#include <linux/kernel.h>

#include <linux/hash.h>

#include <linux/gcd.h>

#include <asm/param.h>

#include <linux/jiffies.h>

/* This function is called when the module is loaded. */

static int simple_init(void)

{

  printk(KERN_INFO "Loading Module\n");

  printk(KERN_INFO "These are the HZ: %d\n", HZ);

  printk(KERN_INFO "These are the jiffies: %lu\n", jiffies);

  printk(KERN_INFO "Golden Ratio is: %lu\n", GOLDEN_RATIO_PRIME);  

  return 0;

}

/* This function is called when the module is removed. */

static void simple_exit(void) {

  printk(KERN_INFO "Removing Module");

  unsigned long a = gcd(3300, 24);

  printk(KERN_INFO "Greatest Common Denominator between 3,300 and 24 is: %lu\n", a);

  printk(KERN_INFO "These are the jiffies: %lu\n", jiffies);

}

/* Macros for registering module entry and exit points. */

module_init( simple_init );

module_exit( simple_exit );

MODULE_LICENSE("GPL");

MODULE_DESCRIPTION("Simple Module");

MODULE_AUTHOR("SGG");

7 0
3 years ago
Other questions:
  • What is are example of an engineered item?
    12·1 answer
  • What does in-private or incognito browsing do?
    5·1 answer
  • The _____ icon allows the user to improve the brightness, contrast, or sharpness of the picture.
    10·1 answer
  • The layout gallery displays 10 slide layouts with a variety of placeholders to define text and content positioning and formattin
    13·1 answer
  • What action makes RAM on your computer disappear?
    12·2 answers
  • Mary is writing an article about the animal kingdom. She wants to place image below the text. Which menu should Mary choose for
    15·2 answers
  • Incident damage ____ is the rapid determination of the scope of the breach of the confidentiality, integrity, and availability o
    6·1 answer
  • How should tools be stored <br>​
    13·1 answer
  • Who is he can anyone help me​
    14·2 answers
  • Which statement is true about hacking?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!