To check whether given input is palindrome or not in python
string = input("Enter a string")
string = string.casefold()
revofstring = reversed(string)
if list(string) == list(revofstring):
print("The string is palindrome")
else:
print("The string is not palindrome")
Comments
Post a Comment