Hello. There is the following task: using reduce (the choice fell on it, but perhaps this is not true) sum up the 1 / y relationship, where y is the list element
you can pre-perform a division operation and you will obviously:
pers_of_coef = reduce((lambda x, y: x + y), coef_arr) but I would like to fit all in one line. The following expression does not work correctly:
pers_of_coef = reduce((lambda x, y: x + (1/y)), coef_arr) As I understand it, in this solution x is the first element, and it is not normalized (1 / x), as a result there is an option to insert a 0 position on the list zero, but this option also does not seem optimal.