Код + скриншот с кодом и выводом компилятора:
x = int(input("Define a constant: x = "))
n = int(input("Enter: n = "))
result = 0
addition = 0
for k in range(0,n+1):
k_plus_one_fact = 1
for k_pr in range(1,(k+1)+1):
k_plus_one_fact *= k_pr
addition = ((-1)**k)/((k_plus_one_fact)**2)*(((x)/(2))**(2*(k+1)))
result += addition
print("Result = ",'{:.2f}'.format(result))
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Код + скриншот с кодом и выводом компилятора:
x = int(input("Define a constant: x = "))
n = int(input("Enter: n = "))
result = 0
addition = 0
for k in range(0,n+1):
k_plus_one_fact = 1
for k_pr in range(1,(k+1)+1):
k_plus_one_fact *= k_pr
addition = ((-1)**k)/((k_plus_one_fact)**2)*(((x)/(2))**(2*(k+1)))
result += addition
print("Result = ",'{:.2f}'.format(result))