🎯 Assessment Goals
- Trace the execution of a program that modifies a list.
- Predict the state of a list after operations like
.append(),.pop(), and.remove(). - Explain the logic behind why the list contents changed.
Minor Assessment: List Prediction & Analysis (3%)
It is time to test your understanding of how lists work "under the hood." You will analyze a Python script that creates and modifies a list of tasks.
⚠️ Important Instruction
To achieve full marks (Level 4), you must do more than just provide the correct output. You must also explain your reasoning. For each question, tell me why the list looks the way it does (e.g., "The item 'Chips' moved to index 2 because we popped the item before it").
The Code to Analyze
Note

The Questions
In a separate document, answer the following. Use the format provided:
- After Line 8 runs:
a) What are the exact contents of the list
tasks? b) Explanation: What did the code do to the list? - After Line 12 runs:
a) What are the exact contents of the list
tasks? b) Explanation: How did the item at index 1 change? - After Line 16 runs:
a) What are the exact contents of the list
tasks? b) Explanation: How does.remove()decide what to delete? - After Line 20 runs:
a) What value is stored in the variable
popped_item? b) Explanation: What does.pop()do when no index is given? - After Line 24 runs:
a) What are the exact contents of the list
tasks? b) Explanation: How is the order determined now? - Final Output (Lines 28-29): a) What text will be printed to the screen by the loop? b) Explanation: Why does the loop print separate lines?
Submission
Submit your document to the "Unit 5 List Prediction Lab" Assignment folder.