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 12 +10002 +662229+123+890+7297+7228
Molly's friend, Xavier, has 11/8 cups of strawberries. He needs 3/4 cup of strawberries to make a batch of tarts. How many batches can he make?
Find the GCF of the terms of the polynomial. 24x^5 + 18x^9
What is the value of the number in the hundredths place
Where do we find molar mass?
Please help me!!!! What is the volume of the figure.
This is super important need help real help no fake answers !
Choose the point slope form of the equation below that represents the line that passes through the points (-3, 2) and (2, 1)
What are four signs a chemical reaction has taken place?
What is the value of x enter your answer you answer in the box