Problem · Easy · 10 min
Palindrome phrase
- Easy
- Strings
- Two pointers
A phrase is a palindrome when it reads the same from left to right and from right to left, if you look only at letters and digits and ignore the case of the letters.
Write is_palindrome_phrase(text). It returns True when the phrase is a palindrome, and False when it is not.
- Ignore every character that is not a letter or a digit.
- A text with no letters and no digits is a palindrome.
Examples
| Call | Result |
|---|---|
is_palindrome_phrase('A man, a plan, a canal: Panama') |
True |
is_palindrome_phrase('hello') |
False |
is_palindrome_phrase('') |
True |
Tasks
2 to do
Task 1, not checked yet. Make
is_palindrome_phrasepass the example tests.Task 2, not checked yet. Make
is_palindrome_phrasepass the hidden tests.
Task 1 of 2
Make is_palindrome_phrase pass the example tests.