Function Name: mean() Parameters: sample a list of integer values Return Value: None - Description: You are probably familiar with the arithmetic mean of a sample – the kind of mean where you sum the values of the sample (perhaps grades or test scores) and you divide by the number of values. It turns out there are several kinds of mean: arithmetic mean, geometric mean, harmonic mean, and plenty more! Your task is to write a function that computes arithmetic mean and the geometric mean of a sample. To compute the geometric mean of a sample, you first take product of all the values, and then you take the n-th root of the product, where n is the number of values you have (see the picture below). n x1 x2 • • xn Test Cases: >>> mean([1, 2, 3]) AM: 2.0 GM: 1.81712059283 >>> mean([4, 4, 2, 10, 13, 57, 68, 70, 99, 105]) AM: 43.2 GM: 20.2740243268
Function Name: mean() Parameters: sample a list of integer values Return Value: None - Description: You are probably familiar with the arithmetic mean of a sample – the kind of mean where you sum the values of the sample (perhaps grades or test scores) and you divide by the number of values. It turns out there are several kinds of mean: arithmetic mean, geometric mean, harmonic mean, and plenty more! Your task is to write a function that computes arithmetic mean and the geometric mean of a sample. To compute the geometric mean of a sample, you first take product of all the values, and then you take the n-th root of the product, where n is the number of values you have (see the picture below). n x1 x2 • • xn Test Cases: >>> mean([1, 2, 3]) AM: 2.0 GM: 1.81712059283 >>> mean([4, 4, 2, 10, 13, 57, 68, 70, 99, 105]) AM: 43.2 GM: 20.2740243268
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
You have to make sure that all the variables you use in your solution are floats. (1.0 instead of 1 and 0.0 instead of 0)
![Function Name: mean()
Parameters:
sample a list of integer values
Return Value: None
-
Description: You are probably familiar with the arithmetic mean of a sample – the kind of mean where you
sum the values of the sample (perhaps grades or test scores) and you divide by the number of values. It turns
out there are several kinds of mean: arithmetic mean, geometric mean, harmonic mean, and plenty more!
Your task is to write a function that computes arithmetic mean and the geometric mean of a sample. To
compute the geometric mean of a sample, you first take product of all the values, and then you take the n-th
root of the product, where n is the number of values you have (see the picture below).
n
x1 x2
• •
xn
Test Cases:
>>> mean([1, 2, 3])
AM: 2.0
GM:
1.81712059283
>>> mean([4, 4, 2, 10, 13, 57, 68, 70, 99, 105])
AM: 43.2
GM: 20.2740243268](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F717f4d87-5a32-4cdf-855f-90bb556622e3%2F7b5f5ab1-122e-4032-bf45-c002f1a97958%2F9hocxss_processed.png&w=3840&q=75)
Transcribed Image Text:Function Name: mean()
Parameters:
sample a list of integer values
Return Value: None
-
Description: You are probably familiar with the arithmetic mean of a sample – the kind of mean where you
sum the values of the sample (perhaps grades or test scores) and you divide by the number of values. It turns
out there are several kinds of mean: arithmetic mean, geometric mean, harmonic mean, and plenty more!
Your task is to write a function that computes arithmetic mean and the geometric mean of a sample. To
compute the geometric mean of a sample, you first take product of all the values, and then you take the n-th
root of the product, where n is the number of values you have (see the picture below).
n
x1 x2
• •
xn
Test Cases:
>>> mean([1, 2, 3])
AM: 2.0
GM:
1.81712059283
>>> mean([4, 4, 2, 10, 13, 57, 68, 70, 99, 105])
AM: 43.2
GM: 20.2740243268
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education