This is a question from one exam. Lets say we have a function, def palindrome (s), and we call it. If it is a palindrome, the function should return True.
def palindrome(s):
...
palindrome("radar")
In order to check if it is a palindrome, i tried to reverse the string in order to see if it was the same. I used s.find(s[::-1])
.
The alternatives from the exam was:
return bool(s.find(s[::-1]))
return not(bool(s.find(s[::-1]
I don't understand the difference between these two alternatives, can someone explain?