[Solved] Calculate s = 1 / sin1 + 1 / (sin1 + sin2) + … 1 / sin (1 + .. n)


Do you mean this?

import math
n = int(input("Enter n: "))
i = 1
s = 0
while i <= n:
    s += 1/math.sin(sum(range(1,i+1)))
    i += 1
    print(s)

If you want to see each item during iterations

import math
n = int(input("n = "))
i = 1
s = 0
while i <= n:
    r = 1/math.sin(sum(range(1,i+1)))
    s += r
    i += 1
    print(r)

2

solved Calculate s = 1 / sin1 + 1 / (sin1 + sin2) + … 1 / sin (1 + .. n)