Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!