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

Definitions are subject to individual interpretation. a.denotation b. connative
Which of the following is true of Tenochtitlan, the center of the Aztec culture? It was built in the middle of a lake and had many canals. It was located in a r
Suppose you buy a CD for $900 that earns 8% APR and is compounded quarterly. The CD matures in 3 years. Assume that if funds are withdrawn before the CD matures
Factors which let to political instability in Europe
78 divided by 48 what is it between
To live deep ocean what condition do a fish need to be adapted for
Determine if convergent or divergent using comparison tests
What is the figure of speech in the sentence Honors are silly toys.
luna chose a card at random from a standard deck of 52 cards. What is the probability that she chose a spade greater than 10 ( J,Q,K,A) ? A. 4 B. 1/2 C. 4/13 D.
what percent of 108 is 81