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

Expected Output
20
50
90
140
200
270
350
440

1 Answer

2 votes

In python:

total = 0

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

total += x

print(total)

I hope this helps!

User Ryo
by
6.5k points