Reverse and Palindrome of a String

Python program to reverse a given string and check whether the give string is palindrome or not. 

string = input("Please enter your own String : ")

str = ' '

for i in string:

    str = i + str

print("The Original String is: ", string)

print("The Reversed String is: ", str)

def isPalindrome(string):

return string == string[::-1]

ans = isPalindrome(string)

if ans:

print("The Given string is a Palindrome")

else:

print("The Given string is Not a Palindrome")



 

OUTPUT

Please enter your own String : malayalam

The Original String is:  malayalam

The Reversed String is:  malayalam

The Given string is a Palindrome

 

Please enter your own String : HELLO WORLD

The Original String is:  HELLO WORLD

The Reversed String is:  DLROW OLLEH

The Given string is Not a Palindrome