Strings · Intermediate · 60 XP · about 6 min
Write a function called is_palindrome(s) that returns True if the string is a palindrome (reads the same forwards and backwards), and False otherwise.
The check should be case-insensitive and ignore spaces.
is_palindrome("racecar") # Returns True is_palindrome("hello") # Returns False is_palindrome("A man a plan a canal Panama") # Returns True is_palindrome("Was it a car or a cat I saw") # Returns True
Ready?
Accept the challenge to start writing. A small timer counts the time this page is in view.
Output appears here.