vendredi 29 juillet 2016

Python palindrome code not working

I just write a program for checking palindrome in python. I don't know why it is not working. Any help will be greatly appreciated.

def palindrome(word):
    rev_palindrome = []
    for i in word[::-1]:
        rev_palindrome.append(i)
        " ".join(rev_palindrome)
    if word == rev_palindrome:
        print "It is a palindrome"
    else:
        print "It is not a palindrome"
palindrome(mom)

Aucun commentaire:

Enregistrer un commentaire