-
-
Notifications
You must be signed in to change notification settings - Fork 157
Open
Description
Error reported in course pythonds on page GettingStartedwithData by user UPS umongia@gmail.com
In the following code when we print(A) after changing the element in myList - A shows the new value whereas if I run the same code on my local or an online REPL, it prints the same value as before for A
myList = [1,2,3,4]
A = [myList]*3
print(A)
myList[2]=45
print(A)
Output in runestone: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]]
[[1, 2, 45, 4], [1, 2, 45, 4], [1, 2, 45, 4]]
Output in local: [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
[1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
Metadata
Metadata
Assignees
Labels
No labels