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

what are carbs and proteins ?anyone wànna talk a bit ? :/​
5y/3 = 30 solve for y simplify your answer as much as possible
HELP IS DUE AT 10pm AND IM IN THE LAST QUESTION SOMEBODY PLEASE SOS
What picture did Haw see in his mind, what did he write after this image occurred to him and how does this apply to us in everyday life?
(2) How do unsocial people take undue advantage of a calamity? ​
Given the following information, calculate net worth: Liquid assets Real estate Personal property Investments Current liabilities Long-term liabilities $10,000
The character is katniss Everdeen from the hunger games novel.
How does your map illustrate the idea of Manifest Destiny? (at least a paragraph)
Nitin and Sharat were going to Delhi by different trains.  Their trains were scheduled to reach at 10:30 am and 11:15am respectively.  Nitin’s train reached l
What effect would that have on the force resulting in accordance to Newton's Third law ?