Assuming that the following snippet has been successfully executed, which of the equations are True? (Choose two.)
Assuming that the following snippet has been successfully executed, which of the equations are True? (Choose two.)
AC
For you who thought it was AD, here is the explanation: When you have an array in a variable and set it to another variable, they share the same id, that means they point to the same array. a = [1] b = a print(id(a), id(b)) # same id Since a==b, when you set a[0] = 0, you are "also" doing b[0] = 0
A and C are correct. a = [1] b = a a[0] = 0 print(len(a) == len(b)) # True print(a[0] == b[0]) # True
a and b are the same list A. len(a) == len (b) C. a [0] == b [0]
The Answer is suprisingly A & C, i thought it was A & D until i tried it
A & C is correct.
Correct Answer is A C
A & D Are the correct answers.
a=[1] b=a a[0]=0 print(len(a)==len(b))#True print(b[0]+1 == a[0])#False print(a[0] == b[0])#True print(a[0]+1 == b[0])#False Ans is A,C
After executing the snippet: a = a[0] = 0 b = b[0] = 1
A and C are correct
if you print(b[0]) it will print 0, so the answer is A and C.
a=[1] b=a a[0]=0 print(len(a) == len(b)) -> True print(a[0] == b[0]) --> True print(b[0] + 1 == a[0]) --> False print(a[0] + 1 == b[0]) --> False My answer is A and C
Correct answer is A C
A C are correct