Here's how to read the error: focus on not iterable
. Something in the line is attempting to iterate. The only part that makes sense for is sum(map(float, final))
. So we know that final
is None
.
final
is the return value of calculate
. Looking at the code, calculate
does indeed return nothing, rather than the expected iterable.
At one point, calculate
states
if set_row == 3:
return cal_temp
However, the corresponding else recursively calls calculate(loop_temp, set_row)
and discards the return value. You probably want to keep the recursive return value and return it:
return calculate(loop_temp, set_row)
As usual with these types of problems, the error is entirely in your code, and not in the thoroughly tested and generally well thought-out libraries you are using.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…