Skip to content

Tag: for-loop

Why my function (f(x)=x*2) doesn’t returns anything?

I know that there are way simpler ways to calculate the square of a number and store it in an array, but for the sake of another problem. I need to understand why nothing happens in this code and its structure (is the return(a) necessary ?): The goal is to store the square in sol : sol = [1,4,9,16,25]. But