lindajones2268 lindajones2268
  • 02-01-2021
  • Computers and Technology
contestada

Write a program to find the sum of given series: (a) S = 1 + (1/2) + (1/3) + ...... + (1/20)

Respuesta :

Cytokine
Cytokine Cytokine
  • 02-01-2021

total = 0

numerator = 1

denominator = 1

while denominator != 20:

   total += numerator/denominator

   denominator+=1

print(total)

I wrote my code in python 3.8. I hope this helps.

Answer Link

Otras preguntas

The AIDA approach includes? 1) Attention 2) Interest 3) Desire and action 4) All of the above
Using front-end estimation, what is the correct estimation of the sum, 23+33+44+51+31 -A. 180B. 170C. 160D. 150
What is the cause of the effect many more new inventions are created as a result
Grace saved £9 in March. She saved £19 in April and £11 in May. Then Grace spent £23 on a keyboard. How much money does Grace have left?
A visual tool that works hand in hand with the agent's dialogue is the ________.
What is the equivalent ratio to 12:6? 1) 20:10 2) 9:2 3) 35:18
Janie's total trip to and from school is 0.68 of a mile. How far did she walk if she makes this trip 27 days last quarter?
Which of the following correctly completes the explicit list function with a specified size count? a) explicit list(size_type count) b) explicit list(size_type
Consider the plot of f(x) = 10ˣ. Write the equation of line l.a) y = 10xb) y = 10ˣ+¹c) y = log(base 10)(x)d) y = log(base 10)(10x)
∑(n=1)([infinity]) [(3n)/(4n³ + 2)]A) ConvergesB) Diverges