Code a function called “minimize”
ACCEPT one input: a function.
function will take a single argument, a number between 0 and 50 exclusive
and then, the function will return a numpy array of 1000 numbers.
RETURN the value that makes the mean of the array returned by ‘passed_func’ as close to 0 as possible
Note, you will almost certainly NOT be able to find the number that makes the mean exactly 0
example
def minimize( passed_func):
“”"
Find the numeric value that makes the mean of the
output array returned from ‘passed_func’ as close to 0 as possible.
Positional Argument:
passed_func -- a function that takes a single number (between 0 and 50 exclusive)
as input, and returns a list of 1000 floats.
Example:
passed_func = hidden
min_hidden = minimize(passed_func)
print(round(min_hidden,4))
#--> 43.1204 (answers will vary, must be close to 43.123985172351)### GRADED
Code a function called “minimize”
ACCEPT one input: a function.
That function will be similar to hidden
created above and available for your exploration.
Like ‘hidden’, the passed function will take a single argument, a number between 0 and 50 exclusive
and then, the function will return a numpy array of 1000 numbers.
RETURN the value that makes the mean of the array returned by ‘passed_func’ as close to 0 as possible
Note, you will almost certainly NOT be able to find the number that makes the mean exactly 0
def minimize( passed_func):
“”"
Find the numeric value that makes the mean of the
output array returned from ‘passed_func’ as close to 0 as possible.
Positional Argument:
passed_func -- a function that takes a single number (between 0 and 50 exclusive)
as input, and returns a list of 1000 floats.
Example:
passed_func = hidden
min_hidden = minimize(passed_func)
print(round(min_hidden,4))
#--> 43.1204 (answers will vary, must be close to 43.123985172351)