Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON ONLY! PLEASE FOLLOW THE FORMAT/DIRECTIONS GIVING ONLY! SO I CAN LEARN. Write a program neans.py that reads in positive real numbers from standard input

image text in transcribedPYTHON ONLY! PLEASE FOLLOW THE FORMAT/DIRECTIONS GIVING ONLY! SO I CAN LEARN.

Write a program neans.py that reads in positive real numbers from standard input and writes their geometric and harmonic means. The geometric mean of n positive numbers x_1, x_2, ...x_n is (x_1 times x_2 times ... times x_n)^1 and their harmonic mean is n/(1/x_1 + 1/x_2 + ... + 1/x_n) # 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 talking logarithms to avoid overflow. for v in a: # Write the results (geometric and harmonic means)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

=+ d. a professor deciding how much to prepare for class

Answered: 1 week ago