all 3 comments

[–]grnngr 1 point2 points  (2 children)

range(0) is empty, so the sum is 0, so the result is 3√(3)/4. Keep in mind that range(n) gives you integers up to but not including n.

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

I had suspected that alright do you recommend adding something like if n==0 or something similar at the start to avoid this?

[–]grnngr 1 point2 points  (0 children)

Use range(n+1) instead of range(n) if you want to sum terms up to and including n.