Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following question It is in python Consider the following program: import copy vals = ['a', ['b', 'c']] copy1 = vals copy2 = vals[:]

Answer the following question

It is in python

Consider the following program:

import copy vals = ['a', ['b', 'c']] copy1 = vals copy2 = vals[:] copy3 = copy.deepcopy(vals) _________ print(copy1, copy2) print(copy2, copy3)

Question 1: Fill in the blank in the program with a line of code that alters vals in a way that causes print(copy1, copy2) to print out two different lists. Your line of code must only operate on vals: you can't directly alter copy1 or copy2.

________________

Question 2: Fill in the blank in the program with a line of code that alters vals in a way that causes print(copy2, copy3) to print out two different lists. Your line of code must only operate on vals: you can't directly alter copy2 or copy3.

________________

Question 3:

copy1 is:

a shallow copy of vals

a deep copy of vals

neither

Question4:

copy2 is:

a shallow copy of vals

a deep copy of vals

neither

Question 5:

copy3 is:

a shallow copy of vals

a deep copy of vals

neither

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago