Question: Practice Question 2: Passing a Function as a Variable Write a function, stats(f, 1), that returns what you would get if you call f(1).That is,

Practice Question 2: Passing a Function as a Variable Write a function, stats(f, 1), that returns what you would get if you call f(1).That is, f is a function that computes a given statistic on a set of data, and 1 is a list of data points To test, use the functions bound, span, and mean from the previous lab. In [ ]: # Write your answer here. In [ ]: DATA1[1, 2, 3, 4, 5, 6] DATA2 = [ for i in range(100) if % 3 In : stats (span, DATA1)5 In [ ] : stats(mean, DATA1)-:).5 In [ J: stats(bound, DATA2), 99] (Alt + A) Practice Question 2: Passing a Function as a Variable Write a function, stats(f, 1), that returns what you would get if you call f(1).That is, f is a function that computes a given statistic on a set of data, and 1 is a list of data points To test, use the functions bound, span, and mean from the previous lab. In [ ]: # Write your answer here. In [ ]: DATA1[1, 2, 3, 4, 5, 6] DATA2 = [ for i in range(100) if % 3 In : stats (span, DATA1)5 In [ ] : stats(mean, DATA1)-:).5 In [ J: stats(bound, DATA2), 99] (Alt + A)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
