Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Total: 10 pts True or False. 1pt for each. 1. These steps reflect the operation of all assignments in the Python language: 1) create an
Total: 10 pts True or False. 1pt for each. 1. These steps reflect the operation of all assignments in the Python language: 1) create an object to represent the value; 2) then create the variable if this variable does not yet exist; 3) finally, link this variable to the object created. 2. In Python, whenever a name is assigned to a new object, the space held by the prior object is reclaimed if it is not referenced by any other name or object - that is, the object's space is automatically thrown back into the free space pool, to be reused for a future object. 3. For string a = "string", we do b=a a = "new string" we have b holding "new string". 4. For list I = [1, 2, 3, 4], we do 11 = 1 1.append(1) we have 11 holding the original value [1, 2, 3, 4] 5. After shallow coping 11 to 12(12 = copy.copy(11)) where 11 = [[2, 3, 4], ["a", "b", "c"]], even though we do 11[0][0] = 0, we can have 12 holding [[2, 3, 4], ["a", "b", "c"]]- 6. After deep coping 11 to 12(12 = copy.deepcopy(11)) where 11 = [[2, 3, 4], ["a", "b", "c"]], even though we do 11[0][0] = 0, we can have 12 holding [[2, 3, 4). ["a", "b", "c"]]. 7. These ways of coping list 11 to 12 are all shallow copies: 12 = 11[:). 12 = list(1). 12 = copy.copy(11). 8. For L = [1,2,3] M = [1, 2, 3] Land M holds the same value(True for L == M) but different id (False for Lis M). 9. For small numbers X = 42 Y = 42 X and Y holds the same value (True for X == Y) but different id (False for X is Y). 10. For large numbers X = 12321341234 Y = 12321341234 X and Y holds the same value (True for X == Y) but different id (False for X is Y)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started