Question: Put the following lines into a glowscript script and run them: energies = [ 1 0 , 1 0 , 7 , 2 ] E
Put the following lines into a glowscript script and run them:
energies
E
for energy in energies:
E E energy
printE
Notice that when you copy this code to glowscript, the indents are not copied. Since indentation is very important in python, fix the indentation in the copied code after the line that begins with for so that it looks similar to the provided code.
Match the line of programming syntax with the lettered statement describing the action of the syntax.
A Displays the sum of the energies ie the total energy
B Loops through the energies and assigns each item to energy succesively.
C Adds the value of energy to the running total.
D Assigns an initial value to the running total.
A: printE
B: for energy in energies:
D: E
C: E E energy
You are correct.
Your receipt no is Help: Receipt Previous Tries
b What is the value of the variable "energy" the second time through the for loop?
Feel free to add a "printenergy within the for loop. Look for the second value printed. For additional insight, compare what is printed to what's inside the list "energies".
Incorrect. Tries Previous Tries
c What is the final value of E
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
