Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code returning a different result on runestone vs local #61

Open
irunestone opened this issue Apr 12, 2019 · 1 comment
Open

Code returning a different result on runestone vs local #61

irunestone opened this issue Apr 12, 2019 · 1 comment

Comments

@irunestone
Copy link

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]

@bnmnetp
Copy link
Member

bnmnetp commented Apr 12, 2019

I'm not sure what you are using for your local python, but I get the same output in both 2.7.10 and 3.7 on my local copies of Python. I think you are doing something different on your local python as you will notice that you are not getting the correct result of 3 lists to start with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants