Practice

Problem 1 of 10

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

  1. Task 1, not checked yet. Make is_palindrome_phrase pass the example tests.

  2. Task 2, not checked yet. Make is_palindrome_phrase pass the hidden tests.

Task 1 of 2

Make is_palindrome_phrase pass the example tests.

All tasks

main.py

Ctrl+Enter runs your code. Ctrl+Shift+Enter runs all the tests. Press Esc, then Tab, to leave the editor.

Output

Press Run to see your result

Your output shows here. Press Run to try your code.