Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Concept explainers

Question
Book Icon
Chapter 11, Problem 1PE
Program Plan Intro

Modified statistics program

Program plan:

  • Import the necessary modules.
  • Define the “mean()” function,
    • Returns mean value to the caller.
  • Define the “StdDev()” function,
    • Returns standard deviation value to the caller.
  • Define the “meanStdDev()” function,
    • Returns average standard deviation value to the caller.
  • Define the “median()” function,
    • Returns median value to the caller.
  • Define the “main()” function,
    • Get comma separated values from the user.
    • Separate the value based on “,” using “split()”.
    • Create a “for” loop to iterate over comma separated values.
      • Assign the value.
        • Print the options.
        • Create sentinel loop to get numbers.
        • Prompts the user for the type of operation to perform.
        • Check whether the operation is “Avg” using “if” .
          • If it is true, print mean value return from “mean()” function.
        • Otherwise, check whether the operation is “Med” using “elif”.
          • If it is true, print median value return from “median()” function.
        • Otherwise, check whether the operation is “Std” using “elif”.
          • If it is true, print standard deviation return from “stdDev()” function.
        • Otherwise, check whether the operation is “AvgStd” using “elif”.
          • If it is true, print average standard deviation value return from “meanStdDev()” function.
        • Otherwise, check whether the operation is empty (‘ ‘)using “elif”.
          • If it is true, use “break” to exit.
          • Otherwise print “Please try again”.
  • Call the “main()” function.

Blurred answer
Students have asked these similar questions
Write in C++ Alice is trying to monitor how much time she spends studying per week. She going through her logs, and wants to figure out which week she studied the least, her total time spent studying, and her average time spent studying per week. To help Alice work towards this goal, write three functions: min(), total(), and average(). All three functions take two parameters: an array of doubles and the number of elements in the array. Then, they make the following computations: min() - returns the minimum value in the array sum() - returns the sum of all the values in the array average() - returns the average of all the values in the array You may assume that the array will be non-empty. Function specifications: Function 1: Finding the minimum hours studied Name: min() Parameters (Your function should accept these parameters IN THIS ORDER): arr double: The input array containing Alice's study hours per week arr_size int: The number of elements stored in the array Return Value:…
Write a program that loads in historical data on popular baby-names for the last 100 years. You can type in a name, and it graphs the rank of that name over time. A high ranking, like 5, means the name was the 5th most popular that year (top of the graph), while a low ranking like 879 means the name was not that popular (bottom of the graph).   Write it in python the latest version   The first function you will write and test is the clean_data function. The function is described in the starter code in a function header comment above the function. Here is the function:   def clean_data(list, x): #TODO: write your code here pass   Take a look at the first few lines of the data file: A 83 140 228 286 426 612 486 577 836 0 0 Aaliyah 0 0 0 0 0 0 0 0 0 380 215 Aaron 193 208 218 274 279 232 132 36 32 31 41   Each line is a baby name followed by how popular the name was in 11 different years. Each number is a ranking, so Aaron was 193th most popular name in 1900 and 41st most popular name in…
Write a program that loads in historical data on popular baby-names for the last 100 years. You can type in a name, and it graphs the rank of that name over time. A high ranking, like 5, means the name was the 5th most popular that year (top of the graph), while a low ranking like 879 means the name was not that popular (bottom of the graph).    Write it in python the latest version   The first function you will write and test is the clean_data function. The function is described in the starter code in a function header comment above the function. Here is the function:   def clean_data(list, x): #TODO: write your code here    pass   Take a look at the first few lines of the data file: A 83 140 228 286 426 612 486 577 836 0 0 Aaliyah 0 0 0 0 0 0 0 0 0 380 215 Aaron 193 208 218 274 279 232 132 36 32 31 41     Each line is a baby name followed by how popular the name was in 11 different years. Each number is a ranking, so Aaron was 193th most popular name in 1900 and 41st most…
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education