I have a some code:
first = ['a','b']
second = first
second.append('c')
print('Test results: ',first == second, first is second)
Which returns Test results: True True
.
I expected to get False False
. I thought that because the second.append('c')
by appending the 'c'
, the two variables stores different objects - meaning first = ['a','b']
and second = ['a','b','c']
Why do I get True True
?