Question: This code cell converts the data from the file into a list of integer values, and stores the result in variable Answer 1 . It

This code cell converts the data from the file into a list of integer values, and stores the result in variable Answer1. It also prints Answer1 so you can see the result. WebCAT will grade the contents of Answer1.
But, there is a bug. First, run the entire notebook (click "Kernel | Restart and Run All" or the FastForward button on the toolbar). Notice the printed results here are incorrect, displaying an empty list. Why?
Now immediately run this code cell again (click the cell, then shift-enter). Magically the correct Answer1 is shown containing several integer values. Why did it change? Hint: See the code in Problem 2. Python maintains state, despite out of order interactive execution, code edits, etc.
So you might think that the result is now correct and can be submitted to WebCAT. No, WebCAT will run the code cells in order from scratch, and produce the wrong result in Answer1.This code cell converts the data from the file into a list of integer values, and stores the result in variable Answer1. It also prints Answer1 so you can see the result. WebCAT will grade the contents of Answer1.
But, there is a bug. First, run the entire notebook (click "Kernel | Restart and Run All" or the FastForward button on the toolbar). Notice the printed results here are incorrect, displaying an empty list. Why?
Now immediately run this code cell again (click the cell, then shift-enter). Magically the correct Answer1 is shown containing several integer values. Why did it change? Hint: See the code in Problem 2. Python maintains state, despite out of order interactive execution, code edits, etc.
So you might think that the result is now correct and can be submitted to WebCAT. No, WebCAT will run the code cells in order from scratch, and produce the wrong result in Answer1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!