What is the output of the following Python code? a = ; b = ; c = a; print(a == b, a is b, a is c)
Correct answer C. True False True
Explanation
The == operator compares values, so two separate lists with the same items are equal. The is operator compares identity: a and b are two distinct list objects created by separate list displays, so a is b is False. c = a binds a second name to the same object, so a is c is True.
Answer checked How we write and check questions
Discussion