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

A gardener is planting two types of trees: Type A is 3 feet tall and grows at a rate of 18 inches per year. Type B is 4 feet tall and grows at a rate of 10 inch
given the ABC DEF find the value of x and y
Which of the following is not a primary function of dietary protein? A. Regulating metabolism and fluid balance B. Building new cells and tissues
How are the Igbo people portrayed by Achebe in Things Fall Apart?
A sample of co2 solid and co2 gas differ in their
Dilation of a line by a scale factor 1/3 centered at the point (4,2)
What is formatting text?
A gardener is planting two types of trees: Type A is 3 feet tall and grows at a rate of 18 inches per year. Type B is 4 feet tall and grows at a rate of 10 inch
How is a cell named? A. Column letter then row number B. Row number then column letter C. Column number then row letter D. Row letter th
What is one theme found in Walt Whitman's "I Hear America Singing"?