Intro to Computer Science


Working with Iteration

Code due by Friday, Feb 10th at 11:00 AM

Customer Request #1 (

You are contacted by Dr. Matt Matic who teaches mathematics at Whatsamatta U. He wants to be able consider the idea of summation.

Recall that a summation adds a sequence of numbers, and the result is the total. For example, if we were finding the summation of 5 starting at the value 1, we would find the total is 1+2+3+4+5=15.

Let's always assume that our starting value is 1.

He asks you to write a program that:

For example:


Customer Request #2 (

You are cleaning up in the Hall of Justice the morning after a huge Super Friends bash when a call comes in.... 

"This is the League of Doom!" 

"We are going to blow up Aquaman with one billion pounds of TNT, if you don't give us a bazillion dollars!!!" 




"We have Batman, too" 

Now something has to be done, but there is no one around. It is all up to you. 

Just then a batarang crashes through the window with a message from Batman:

  The code to defuse the bomb is taking all the numbers of the geometric sequence 
  of 3 under 4,000,000 and adding them together.

You must find the sum of all the numbers in the geometric sequence of 3 less than 4 million. You will use python loops to accomplish this. 

The geometric sequence of 3 looks like this 
1, 3, 9, 27, 81, 243, ... where you start with the number one and multiply the previous number by 3 to get the next number.

Remember to actually print out the final answer! 

Final Submission

To upload your homework for grading, log on to eLearning, select this class, and navigate to the "Assignment Submissions" area. Click on the "Programming Assignment 3" folder and upload both python files in their designated locations.

Please submit these files: