एक स्ट्रिंग को देखते हुए, हमारा काम मौसम की जांच करना है कि यह स्ट्रिंग पैलिंड्रोम है या नहीं।
एल्गोरिदम
Step1: Enter string as an input. Step2: Using string slicing we reverse the string and compare it back to the original string. Step3: Then display the result.
उदाहरण कोड
my_string=input("Enter string:")
if(my_string==my_string[::-1]):
print("The string is a palindrome")
else:
print("The string isn't a palindrome") आउटपुट
Enter string:madam The string is a palindrome Enter string:python The string isn't a palindrome