Python One Line Code To Check Palindrome

In python, we can check whether a given string is palindrome or not in one line. See example below:


string = input('Enter anything: ')

print('PALINDROME') if string == string[::-1] else print('NOT PALINDROME')

Output

RUN 1:
-----------------
Enter anything: rotator
PALINDROME

RUN 2:
-----------------
Enter anything: Hello
NOT PALINDROME