solve it as Python

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

solve it as Python

Post by answerhappygod »

solve it as Python
Solve It As Python 1
Solve It As Python 1 (60.67 KiB) Viewed 29 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply