Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Put the following lines into a glowscript script and run them: energies = [ 2 , 1 , 1 , 6 ] E = 0
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 Assigns an initial value to the running total.
B Loops through the energies and assigns each item to energy succesively.
C Adds the value of energy to the running total.
D Displays the sum of the energies ie the total energy
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started