Given string is a palindrome or not.

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
  1. Take a string as input.
  2. Create a variable and assign its value equal to the given string in reverse order.
  3. Check whether both the strings are equal or not using the if else statement.
  4. 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
				
			

find the smallest and largest word in a given string.

reverse the words in a string.

Leave a Comment