Use python programming You are cleaning up in the Hall of Justice the morning af
ID: 3786870 • Letter: U
Question
Use python programmingYou 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.
Assignment
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!
Use python programming
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.
Assignment
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!
Use python programming
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.
Assignment
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!
Explanation / Answer
# Program in Geometric Sum Python
result = 0 # variable to store result
num = 1 # variable to maintain geomtric series and compare with 4 million
# iterate and find sum
while (num < 4000000 ):
num*=3
result+=num
#finally print result
print 'final result of geometric series is:'
print result
Output:
final result of geometric series is: 7174452
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.