Page 1 of 1

solve it as Python

Posted: Thu Jul 14, 2022 2:17 pm
by answerhappygod
solve it as Python
Solve It As Python 1
Solve It As Python 1 (60.67 KiB) Viewed 30 times
Stable String Function Name: stableStr() Parameters: string of characters ( str ) Returns: isStable ( bool) Description: Write a recursive function that takes in a string ( str ) and returns whether the string is 'stable'. A string of length n (highest index is n−1) is 'stable' if the 0th and ((n−1)−0) th characters have the same capitalization, the 1st and ((n−1)−1) th character have the same capitalization, and so on. An empty string is considered stable. Hint: This problem is like recursively checking if a string is a palindrome. Hint: and/or methods may be useful for this problem. ≫ stableStr("KaRThiK") False #This string is unbalanced #because ' z ' and 'B' don't have the same capitlization. ≫> stableStr("AnUpAmA") True