143k views
1 vote
4.9 Code Practice: Question 2

Instructions
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

2 Answers

5 votes

Answer:

sum = 0

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

sum += i

print(sum)

User Avinash Jadhav
by
4.8k points
0 votes

total = 0

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

total += x

print(total)

I hope this helps!

User Zalina
by
5.6k points