Python palindrome using which we can find out whether the given string matches the reversed way of string.
For example :
madam = madam (reversed)
Enter the string
string = input("Enter a string: ")
string = input("Enter a string: ")
string = input("Enter a string: ")
reverse the string
reverse = string[::-1]
reverse = string[::-1]
reverse = string[::-1]
If the string matches then this block get’s executed.
if string == reverse:
print("The string is a palindrome")
if string == reverse:
print("The string is a palindrome")
if string == reverse: print("The string is a palindrome")
else
else:
print("The string is not a palindrome")
else:
print("The string is not a palindrome")
else: print("The string is not a palindrome")
string = input("Enter a string: ")
reverse = string[::-1]
if string == reverse:
print("The string is a palindrome")
else:
print("The string is not a palindrome")
string = input("Enter a string: ")
reverse = string[::-1]
if string == reverse:
print("The string is a palindrome")
else:
print("The string is not a palindrome")
string = input("Enter a string: ") reverse = string[::-1] if string == reverse: print("The string is a palindrome") else: print("The string is not a palindrome")