I declared two variables as follows (one of which is the reverse of the other):
a = "test"
b = "tset" # reverse of a
I then ran this into the interpretor which returned the below value:
>>> b[::-1]
'test' # value returned
As you can see, it reversed the string which made it exactly like the first variable a
.
However, when I execute this statement, the results are not quite the same:
a is b[::-1]
False # returns false after executing above statement
a is "test", so is b[::-1]. So why is it that the condition does not evaluate to True
?