Your question is Palindrome With Cleanup. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
An AstraZeneca data-quality utility receives a free-form study label. Determine whether the label is a palindrome after ignoring letter case and removing all non-alphanumeric characters.
A palindrome reads identically from left to right and right to left after normalization. For this problem, use Python's alphanumeric definition, so str.isalnum() determines whether a character is retained.
Implement valid_palindrome(s).
s, a string.True if the normalized string is a palindrome, otherwise return False.def valid_palindrome(s):