Using Python

In this lesson we learn that the accumulator pattern can be applied to problems where we must keep track of a sum.

The previous lesson counted by adding one to the accumulator at each step. In this problem we accumulate a sum of all the positive even integers less than 62.

Practice Counting

Here is another problem that can be solved with counting.

What is the sum of the even, positive integers less than 62?

You Try It

Use what you just learned about counting in the last lesson to find the answer to this problem. There may be more than one way to solve this problem so don't worry if your solution is different than your neighbors. The answer is 930 so your program should print

The sum is 930

when you are done. Make sure you write a print statement that prints your answer and make sure you arrive at your answer by adding up all the positive even integers less than 62.

HINT: In this problem you don't just add 1 to count each time. What do you add to count?

Next time we will begin writing programs using Turtle graphics. For instance, this program

>> Next Lesson