Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# YOUR SOLUTION GOES HERE Check that statistics returns the correct datatype. assert type(statistics([1.3,5.2,3.7])) == tuple , Return value should be a tuple. assert len(statistics([1.3,5.2,3.7]))

image text in transcribed

# YOUR SOLUTION GOES HERE

"Check that statistics returns the correct datatype." assert type(statistics([1.3,5.2,3.7])) == tuple , "Return value should be a tuple." assert len(statistics([1.3,5.2,3.7])) == 7 , "Return value should be a tuple of length 7." print("Problem 4 Test 1: Success!")

"Check that statistics returns the correct mean value." epsilon = 10e-14 assert abs(statistics([1.0,2.0,3.0])[0] - 2.0)

"Check that statistics returns the correct median value." assert abs(statistics([1.0,2.0,3.0])[3] - 2.0)

"Check that statistics returns the correct standard deviation value." epsilon = 10e-14 assert abs(statistics([1.0,2.0,3.0])[1] - (2/3)**0.5)

"Check that statistics returns the correct range values." epsilon = 10e-14 assert abs(statistics([1.0,2.0,3.0])[2] - 1.0)

please type the Python code on computer

Problem 4 (8 points) Write a function called statistics which takes one input parameter samples , a list of numbers, and returns a tuple (of length 7) of statistics: (mean, standard deviation, minimum, median, maximum, range, total number of samples) Recall, if samples is the list of numbers [Xo, xi,..., xv] then mean standard deviation N +1 range : max{%)-min{x The median is the middle value if the number of samples is odd, or the median is the average of the two middle values if the number of samples is even. Use the built-in function sorted to sort the list of values. Remember: Do not import any Python packages Do not use Python keywords or built-in function names (such as max, min, and range) as variable names

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions