14.6k views
3 votes
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

1 Answer

2 votes

Answer:

The program is as follows:

total = 0

for i in range(3,67,3):

total += i

print(total)

Step-by-step 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)

User Marc Gil Sendra
by
3.8k points