Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sigma, pi, exercise
#1
Photo 
Write programs (for and while) that calculate the sum (product) (using inconditional statement, omit elements that generate the error)

The print statement in each loop should beoutput a string containing the value of the loop counter, the value of the element (in the case of error generating elements, the string ——) and the current one value of the sum (product) with a precision of 5 digits after the decimal point.

Well any advices, i just dont know how to implement that if there are negative numbers, also when cosinus showed up.

I want to implement it in PYTHON.
My code so far:
N=13
s = -4
    for i in range(-4, n+1):
        
        total *= s + 5 / s + 1
        s = s + 1
     print ("[n==%d] Suma = %s" %(n, total))
and description: [Image: ubvCall.png]
Reply


Messages In This Thread
sigma, pi, exercise - by krnkrnkrn - Nov-11-2020, 04:11 PM
RE: sigma, pi, exercise - by DPaul - Nov-12-2020, 06:22 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020