Apr-05-2017, 10:22 PM
So the question is:
I have to do a little program where the function receives a argument x, who is an integer and returns a list of the sum of the first n square roots.
Like [sqrt(1), sqrt(1) + sqrt(2), sqrt(1) + sqrt(2) + sqrt(3), ....]
I've made this line of code but it is just returning the sum
I have to do a little program where the function receives a argument x, who is an integer and returns a list of the sum of the first n square roots.
Like [sqrt(1), sqrt(1) + sqrt(2), sqrt(1) + sqrt(2) + sqrt(3), ....]
I've made this line of code but it is just returning the sum
return sum([x**0.5 for x in range(n+1)])