Create a shallow copy of data using .copy()
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Create a shallow copy of data using .copy(). Append 4 to the "items" list through the copy. Then print data["items"] to show the shallow copy gotcha: the original's list is also modified.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.