Python Program to Check Reverse of a String is equal to its Original value














































Python Program to Check Reverse of a String is equal to its Original value



Description:

When a String is equal to it's reverse , then the String is said to be in PALINDROME.

Program:

def check(a): #This function will check for suitable output to a given input string
	if a==''.join(reversed(a)): #If the reverse of a string is equal to it's original then it's palindrome
		print("The string {} is PALINDROME".format(a))
	else:
		print("The string {} is Not PALINDROME".format(a))
	
if __name__=='__main__':
	opt=input("Enter Your Sting: ") #User Input
	check(opt) #calling of function to check whether the provided string is palindrome or not

Input:

Enter Your Sting: cppsecrets

Output:

The string cppsecrets is Not PALINDROME

Comments