xxxxxxxxxx
string = input("Type a string: ")
if string[::-1] == string:
print(string,"This string is Palindrome")
else:
print(string,"This string is not Palindrome")
xxxxxxxxxx
s = input('enter string: ')
def palindrome(string):
x = ""
for i in string:
x = i + x
return x
if s == palindrome(s):
print('its a palindrome')
else:
print('its not a palindrome')
xxxxxxxxxx
s = "001100"
if s == s[::-1]:
print("palindrome string")
else:
print("Not a palindrome string.")
xxxxxxxxxx
myString = "aba"
if myString == myString[::-1]:
print("The string '" + myString + "' is a palindrome")
else:
print("The string '" + myString + "' is not a palindrome")
xxxxxxxxxx
def is_palindrome(s):
reverse = s[::-1]
if (s == reverse):
return True
return False
s1 = 'racecar'
s2 = 'hippopotamus'
print('\'racecar\' a palindrome -> {}'.format(is_palindrome(s1)))
print('\'hippopotamus\' a palindrome -> {}'.format(is_palindrome(s2)))
# output
# 'racecar' is a palindrome -> True
# 'hippopotamus' is a palindrome -> False
xxxxxxxxxx
n = input("Enter the word and see if it is palindrome: ") #check palindrome
if n == n[::-1]:
print("This word is palindrome")
else:
print("This word is not palindrome")
print("franco")
xxxxxxxxxx
s = "001100"
if s == s[::-1]:
print(s, "is a Palindrome string.")
else:
print("Not a palindrome string.")
xxxxxxxxxx
value = input("Enter a Word: ")
if value == value[::-1] :
print(value)
print(value[::-1])
print("THIS WORD IS A PALINDROME")
else :
print(value)
print(value[::-1])
print("THIS WORD IS NOT A PALINDROME")
xxxxxxxxxx
def isPalindrome(s):
return s == s[::-1]
# Driver code
s = "malayalam"
ans = isPalindrome(s)
if ans:
print("Yes")
else:
print("No")