Question
Hello , I got stuck on rewrite this function. so I've been asked write a new function Check_ispal(word) that takes a string input (word) and:
Hello , I got stuck on rewrite this function.
so I've been asked write a new function Check_ispal(word) that takes a string input (word) and: (a) strips all non-alphanumeric characters (that is, all characters that are not lowercase/uppercase letters or numbers), from word, then (b) converts all uppercase letters in word to lowercase letters and finally, (c) calls ispal() (the one defined in the previous page) with the modified word string. So, when called this way: Check_ispal("A man, a plan, a canal: Panama"), it returns True, and Check_ispal("A Santa at NASA"), also returns True, and Check_ispal("Yawn... Madonna fan? No dann way!!"), also returns True.
the beginning of the function is given
thank you for your help !
def spal (Myst r): if len(MyStr)2: if MyStr[0] !- MyStr[-1]: else: return True return False return ispal (MyStr[1:-1]) def Check-spal(word): print (word, end-":") newword for c in wordStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started