In this program, we will take a string as input and check whether the given string is a palindrome (similar) or not
Steps to solve the program
- Take a string as input.
- Create a variable and assign its value equal to the given string in reverse order.
- Check whether both the strings are equal or not using the if else statement.
- Print the output.
#Input strings
string ="sqatoolssqatools"
string2 = string[::-1]
#Printing output
if string == string2:
print("Given string is a palindrome")
else:
print("Given string is not a palindrome")
Output :
Given string is not a palindrome