0

I was checking whether given is a palindrome or not. This is a similar code to explain the nuances,

string = "radar"
new = string[::-1]
print (new)
print (string is new)
print (string in new)
print (string == new)

Output of above is:

radar
False
True
True

In all these conditionals statements I was expecting output to be True but is returns False even though words are same. Don't know why this keeps happening.

Krish
  • 9
  • 3

0 Answers0