Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Put the following lines into a glowscript script and run them: energies = [ 1 0 , 6 , 1 , 2 ] E =

Put the following lines into a glowscript script and run them:
energies =[10,6,1,2]
E=0
for energy in energies:
E=E+ energy
pr(E)
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 Loops through the energies and assigns each item to energy succesively.
B Adds the value of energy to the running total.
C Assigns an initial value to the running total.
D Displays the sum of the energies (i.e. the total energy).
print(E)
E=E+ energy
E=0
for energy in energies:
1 Tries 0/99
(b.) What is the value of the variable "energy" the second time through the for loop
Tries 0/99
(c.) What is the final value of E?
Tries 0/99
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

Compose the six common types of social business messages.

Answered: 1 week ago

Question

Describe positive and neutral messages.

Answered: 1 week ago