nobodydml
nobodydml nobodydml
  • 15-12-2021
  • Computers and Technology
contestada

Write code using the range function to add up to the series 20,30,40, ...90 and print the resulting sum each step along the way

Write code using the range function to add up to the series 203040 90 and print the resulting sum each step along the way class=

Respuesta :

mark454
mark454 mark454
  • 15-12-2021

Answer:

Code:

range_sum = 0

for x in range(20, 100, 10):

range_sum += x

print(range_sum)

Explanation:

Declare variable (we'll use it to keep track of the sum):

range_sum = 0

Start a loop with the range function (x is the current number, 20, 100 are the numbers to start and stop by and 10 is the number to increase by):

for x in range(20, 100, 10):

Add the current number to the sum and print it:

range_sum += x

print(range_sum)

Answer Link

Otras preguntas

What is   a quarter past 5 mean
what is the Volcanic Intrusion "rule"-
What is 17% as a fraction in simplest form
Ms groves had trays of paint each tray has five colors one of the colors is purple.what fraction of the colors in 20 trays is purple
In the sentence   The football players train for the big game.    what part of speech is train                            The train sped over the tracks.
The message of the DNA Code is information for building_______.
A metal box, attached to a small parachute, is dropped from a helicopter. explain in terms of the forces acting; why:(i) its velocity increased immediately afte
What is the length of the earth's crust? Oceanic and Continental.
The main goal of the Jesuits was to?
What is 17% as a fraction in simplest form