write a program to find the sum S of the series where S = x - x^3 + x^5 + ..... upto N items.
x = int(input('x = ')) n = int(input('n = ')) s = 0 power = 1 sign = 1 for i in range(n): s += sign * (x**power) power += 2 sign *= -1 print(f"sum = {s}")
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments