# Palindrome Words using Python

Palindrome words are those words that are read the same way from left to right as from right to left. Writing an algorithm to check whether a word is a palindrome or not is an important question in coding interviews. In this article, I’ll walk you through how to write a program to check Palindrome words using Python.

## Palindrome Words: Problem Statement

Finding a palindrome word is an important topic that you should prepare for any coding interview. Palindromic words are those words that are read the same way when we read them from both rights and left ends. For example, lol, mom, etc. In coding interviews, you are given a sentence and you are asked to write an algorithm to find palindromic words from that sentence.

Also, Read – 200+ Machine Learning Projects Solved and Explained.

So, to know if a palindrome word is present or not in a sentence, we are usually asked to return the words only once if this word appears more than once in a sentence. So the problem statement goes like this:

Write an algorithm to find all of the palindrome words in a given sentence and if the word appears more than once in the sentence, you should always return that word only once. Hint: Palintrodme words are words that give the same result when you read the word from the beginning or the end.

## Palindrome Words using Python

To find palindromic words using Python, we first need to remove the punctuation marks from the sentence, then we need to move on to the rest of the conditions. Now let’s see how to find palindrome words using Python from any sentence:

So this is how you can write an algorithm to find a palindrome word using Python. Now let’s input a sentence and use this algorithm:

```sentence = input("Enter a sentence : ")
print(palindrome(sentence))```
```Enter a sentence : LOL, My interview went good. My Mom will be so happy.
['lol', 'mom']```

## Summary

So this is how we can find palindrome words from any sentence. This is an import coding interview question. I hope you liked this article on how to find palindrome words using Python. Feel free to ask your valuable questions in the comments section below.

##### Aman Kharwal

Coder with the ♥️ of a Writer || Data Scientist | Solopreneur | Founder

Articles: 1335