Stuck on Exercise 12.5 #3
-
Hello everyone! Here is the result i would get if I enter the same input example: Here is the code
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @coutinholfc Please create the empty "list1" (dictionary) inside the while, otherwise it will only create one dictionary in memory, and the second time that the while iterates, it will change the value of "Real Madrid and Spain" with "PSG and France" (which also affects "List2"). You will learn more about that behavior in Chapter 14 (Section 14.1). |
Beta Was this translation helpful? Give feedback.
Hi @coutinholfc
Please create the empty "list1" (dictionary) inside the while, otherwise it will only create one dictionary in memory, and the second time that the while iterates, it will change the value of "Real Madrid and Spain" with "PSG and France" (which also affects "List2").
You will learn more about that behavior in Chapter 14 (Section 14.1).