4(iii)
Write a Python program to accept a string and check if the given string is a palindrome.
Show SolutionHide Solution↓
st = input("Enter a string: ")
if st == st[::-1]:
print("The given string is a palindrome")
else:
print("The given string is not a palindrome")
Enter a string: madam
The given string is a palindrome
Enter a string: hello
The given string is not a palindrome