Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLE HELP ME BY PYTHON Part 1: Statistical Functions In this part of the assignment, you will write four functions. The first function calculates the

image text in transcribed

PLE HELP ME BY PYTHON

Part 1: Statistical Functions In this part of the assignment, you will write four functions. The first function calculates the reciprocal of a number, which is defined as 1umber. So, for example, the reciprocal of 8 is 1/8, or 0.125. The reciprocal of 2.5 is 1/2.5 or 0.4. You must name the function reciprocal and it takes one parameter. It returns the input parameter's reciprocal. Don't worry about what happens if someone gives a zero as input: they get what they deserve (a divide by zero" error). For the other functions: You are probably familiar with the arithmetic mean; it's also called the average. There are other types of means. There's the geometric mean and the very seldom-used harmonic mean. In this program you will write three functions to calculate each of these means for three numbers. Here are the formulas: a+b+c arithmetic mean=- geometric mean=va.b.c harmonic mean=- 1.1.1 + +- - a - b c Name your functions ran()).geometric_nean() and harmonic_mean() Each of these functions has three parameters. The harmonic_nean() function must use the reciprocal function. Just like reciprocall.don't worry about division by zero. Hint: If you're feeling bold, the harmonic mean is mathematically equivalent to the reciprocal of the arithmetic mean of the reciprocals of the input parameters. This makes the function very short to write! Start with the rathfunctions test.py, program and write your four functions at the top of that file. You may have to import Tath. Then run the program to make sure that it gives the desired results. Name your program in the form lastname_firstname_stats.py Note: in the test program, the geometric means should come out to exactly 12 and 8.4, but floating point is never exact, so you will get answers like 11.999... and 8.3999_

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

What is a web-wrap agreement?

Answered: 1 week ago