Serenaark6707 Serenaark6707
  • 02-07-2021
  • Computers and Technology
contestada

Write code using the range function to add up the series 3, 6, 9, 12, 15, ..... 66 and print the resulting sum. Expected Output 759

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 08-07-2021

Answer:

The program is as follows:

total = 0

for i in range(3,67,3):

   total += i    

print(total)

Explanation:

This initializes the sum of the series to 0

total = 0

This iterates through the series with an increment of 3

for i in range(3,67,3):

Add up all elements of the series

   total += i

Print the calculated sum    

print(total)

Answer Link

Otras preguntas

Please Help Which colony was influenced by Pennsylvania's size and location? A. New Jersey B. Florida C. Virginia D. Massachusetts
Read the second stanza from "Mutability.” We rest.—A dream has power to poison sleep; We rise.—One wandering thought pollutes the day; We feel, conceive or re
what prevented Europeans from exploring the world sooner in the middle ages
When (8668/25) + (4141/9) - (5533/25) is computed and written as a mixed number in simplest form, what is the fractional part of that mixed number?
A pet store started the week with a number of frogs to sell. It sold 24 frogs. Then, in the middle of the week, the store got a delivery of 19 more. It sold ano
Which of the following describes entrepreneurship?
How does feedback inhibition stop the production of energy?
what is the main purpose of the 4th amendment
Calculate the mass of water produced when 4.86 g of butane reacts with excess oxygen.
What type of bond holds together sugar and phosphates