Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/palindrome.py Secret

Created Feb 23, 2021
Embed
What would you like to do?
def palindrome(sentence):
for i in (",.'?/><}{{}}'"):
sentence = sentence.replace(i, "")
palindrome = []
words = sentence.split(' ')
for word in words:
word = word.lower()
if word == word[::-1]:
palindrome.append(word)
return palindrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment