Code returning a different result on runestone vs local

Open
#61 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
content

Research direction

Start with the pythonds course's GettingStartedwithData page and reproduce the provided snippet in Runestone and a local Python REPL. Compare the execution context and displayed output; done means the page produces the expected Python behavior or clearly explains any intentional difference.

Written by the indexing model from the issue text.

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]

Dominant language
Python
Stars
273
Forks
160
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RunestoneInteractive/pythonds

All issues in RunestoneInteractive/pythonds

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.