can anyone help me with this question Write a script that de

can anyone help me with this question?

Write a script that determines the following sum (for all odd n from 3 to 13) using a for loop

y = (2^(n+2))/n-1

Solution

# make sum = 0
sum = 0
# loop in range 3,13, increment n by 2.
for n in range(3,13,2):
   # add y to sum.
   y = (2**(n+2))/float(n-1)
   sum += y
print sum

\"\"\"

sample output

\"\"\"

can anyone help me with this question? Write a script that determines the following sum (for all odd n from 3 to 13) using a for loop y = (2^(n+2))/n-1Solution#

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site