How python checks whether a given string is a palindrome
This article mainly introduces python how to check whether a given string is a palindrome, the article is very detailed, has a certain reference value, interested friends must read it!
Check whether the given string is a palindrome
We have discussed how to reverse strings. So palindrome becomes a simple program in Python.
My_string = "abcba" if my_string = = my_string [::-1]: print ("palindrome") else: print ("not palindrome") # Output # palindrome above is all the contents of the article "how to check whether a given string is a palindrome". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!