Lab#10 Prime number and palindrome

# program to test if a word is a palindrome
# the palindrome is a word that is equal to  his mirror

# function that takes a string as an argument and store the miror in a variable

def mirror(word):
lengh=len(word)
result=””
while lengh>0:
letter=word[lengh-1]
result=result+letter
lengh=lengh-1
return result

a=input(‘Enter a word  :  ‘)
#print(“”)
#
#print(“”)

b=mirror(a)
if a==b:
print(a, “is a palindrome”)
else:
print(a, “is not a palindrome”)

Leave a Reply

Your email address will not be published.