Question: Problem 3. (Geometric and Harmonic Means) Write a program means.py that reads in positive real numbers from standard input and writes their geometric and harmonic

 Problem 3. (Geometric and Harmonic Means) Write a program means.py that

Problem 3. (Geometric and Harmonic Means) Write a program means.py that reads in positive real numbers from standard input and writes their geometric and harmonic mleans. The geometric mean o n positive numbers x1,x2, ,xn is x1 22 xn)1 and their harmonic mean is n/Q/A + 1/T2 + . . . + 1/Zn). Hint: for the geometric mean, consider taking logarithms to avoid overflow; if y (a x bx c)1/d, then Iny (1/d)(Ina InbInc) (say), and y e" s Python3 means.py 1.0 2.0 3.0 4.0 5.0 geometric mean2.605171, harmonic mean 2.189781

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!