Question: Using Python 3 Page 245 in the text says: In order to write a correct iterative process using a while loop, it is necessary to
Page 245 in the text says: "In order to write a correct iterative process using a while loop, it is necessary to include three parts: the initialization, the condition, and the change of state. All of these parts must work together for the iteration to succeed." study the following loop (from Listing 7.7 on p. 247): aline = datafile.readline() # line 7 while aline ! = " ": # line 8 # processing of aline done on lines 9 -12 aline = datafile.readline() # line 13 a. Identify the initialization step (by its line number), and describes its purpose in this example. b. Identify the condition, and use words to say what must be true for this loop to execute (or alternatively when it will stop executing if you prefer to explain i t that way). c. Identify the change of state, and explain how this part works together with the other two parts to make this loop a correct iterative process. Say what is wrong with the following, and what must be done to fix it: i = 0 # while (i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
