## (Solved) # means. reads in positive real numbers from standard input and writes their # geometric and harmonic means. import math import stdio # Read floats...

python help: Write a program means.py that reads in positive real numbers from standard input and writes their geometric and harmonic means. The geometric mean of n positive numbers x1, x2, . . . , xn is (x1 Ã—x2 Ã— Â· Â· Â· Ã— xn)1/n and their harmonic mean is n/(1/x1 + 1/x2 + Â· Â· Â· + 1/xn).

Hint: for the geometric mean, consider taking logarithms to avoid overflow

# means.py: reads in positive real numbers from standard input and writes their
# geometric and harmonic means.
import math
import stdio
# Read floats from standard input into a list a.
a = ...
# Define a variable n storing the length of a.
n = ...
# Define variables gm and hm to store the geometric and harmonic means of
# the numbers in a.
gm = ...
hm = ...
# Iterate over the values in a and calculate their geometric and harmonic
# means. For geometric mean, consider taking logarithms to avoid overflow.
for v in a:
...
...
# Write the results (geometric and harmonic means).
...

Solution details:
STATUS
QUALITY
Approved

This question was answered on: Sep 05, 2019

Solution~000200103670.zip (25.37 KB)

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free solution (Deadline assured. Flexible pricing. TurnItIn Report provided)

STATUS

QUALITY

Approved

Sep 05, 2019

EXPERT

Tutor