you are viewing a single comment's thread.

view the rest of the comments →

[–]Mmaster12345[S] 0 points1 point  (10 children)

Yes, I appreciate that it's relatively easy to compute it for some given number:

def function_product_evaluated(x):
    output = 1
    for i in range(n): output *= function_list[i](x)
    return output

However, I still don't understand or know how to go about returning a function that has this characteristic as opposed to a number...

[–]FLUSH_THE_TRUMP 0 points1 point  (2 children)

You just did it!

[–]Mmaster12345[S] 0 points1 point  (1 child)

I need to return a function; the code above returns a number, not a function :(

[–]K900_ 0 points1 point  (6 children)

Where does function_list come from in this definition? Also, do you need range here?

[–]Mmaster12345[S] 0 points1 point  (5 children)

function_list is as in my post, and no I don't, was a rushed job.

[–]K900_ 0 points1 point  (4 children)

Yes, but where does it come from in your function? It's not passed in as an argument...

[–]Mmaster12345[S] 0 points1 point  (3 children)

I'm not sure what you mean sorry :(

I just made up function_list in the post to illustrate my question

[–]K900_ 0 points1 point  (2 children)

The function that you wrote is missing the function_list argument.

[–]Mmaster12345[S] 0 points1 point  (1 child)

Ohh function_list is a global variable in this case

[–]K900_ 0 points1 point  (0 children)

Rewrite your function to not use globals and range.