import math
def calculate_cosine_sum(x, n):result = 0for i in range(1, n+1):result += math.cos(x**i)return result
x = 0.5n = 5result = calculate_cosine_sum(x, n)print(result)
import math
def calculate_cosine_sum(x, n):
result = 0
for i in range(1, n+1):
result += math.cos(x**i)
return result
x = 0.5
n = 5
result = calculate_cosine_sum(x, n)
print(result)