Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function called trimmed_mean(nums, trim) that takes in a list of numbers (you may assume that the input is valid!), and an optional integer
Write a function called trimmed_mean(nums, trim) that takes in a list of numbers (you may assume that the input is valid!), and an optional integer keyword argument trim (that takes on values of 0 or larger).
This function:
Removes the trim largest and smallest numbers from that list.
returns the arithmetic mean of whatever is left.
By default, trim = 1.
Example
trimmed_mean([2, 3, -100, 50000, 4]) would return 3, because 50000 and -100 are removed, and the mean of [2, 3, 4] is 3.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started