Question: Create a function in python using only strings and lists that takes in one string and returns an integer based on the amount of matching

Create a function in python using only strings and lists that takes in one string and returns an integer based on the amount of matching pairs, the function will keep looking for matching pairs until it runs into a pair that it cannot match. The string will try and match the pairs on the ends of the string so lets say a matches with b, g matches with h and d matches with r. The string "aghrhb" has two matching pairs since b and a match then g and h match once we get to r we see it does not match with h. Another example is "aghahghhrghb" this would have three matching pairs.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!