Checks if the given string is a palindrome.
str.lower()
and re.sub()
to convert to lowercase and remove non-alphanumeric characters from the given string.from re import sub
def palindrome(s):
s = sub('[\W_]', '', s.lower())
return s == s[::-1]
palindrome('taco cat') # True
Python, String
Converts a given string into a list of words.
Python, String
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
Python, String
Pads a given number to the specified length.