my_string = "abcba" if my_string == my_string[::-1]: print("palindrome") else: print("not palindrome") # Output # palindrome
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter