(text)
| 1 | def is_palindrome(text): |
| 2 | text = text.lower() |
| 3 | |
| 4 | cleaned = "" |
| 5 | for char in text: |
| 6 | if char.isalnum(): |
| 7 | cleaned += char |
| 8 | |
| 9 | reversed_text = cleaned[::-1] |
| 10 | return cleaned == reversed_text |
| 11 | |
| 12 | |
| 13 | user_input = input("Enter a word or a sentence:") |