Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def palindrome():
- reverse_word = []
- input_list = []
- input_iterator = 0
- word = input("Enter a word")
- word = word.lower() #changing the letters to be the same lowercase letters
- word_iterator = len(word)
- word_iterator = len(word)
- while input_iterator < len(word):
- input_iterator += 1
- if word[0].isspace == False:
- input_list.append(word[input_iterator])
- if word[input_iterator].isspace == False:
- input_list.append(word[input_iterator])
- input_list = "".join(input_list)
- word = input_list
- while word_iterator > 0: #checking if each letter of the word is the same
- word_iterator -= 1
- if word[word_iterator].isalpha:
- reverse_word.append(word[word_iterator])
- reverse_word = "".join(reverse_word)
- print (reverse_word)
- if reverse_word == word:
- print("palindrome")
- else:
- print("not")
- palindrome()
- #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement