Question: Write a function matches that accepts two strings as arguments. The function then returns the number of times that the two strings have the same

Write a function matches that accepts two strings as arguments. The function then returns the number of times that the two strings have the same character in the same location, ignoring case. For example, in the first example below, the number of matches is 3 because the two strings agree for all characters accept for the characters at index 1. Hints: 1) use indexed iteration to iterate over both strings simultaneously, 2) Q: what should you do if the strings have different lengths? A: ignore the extra characters of the longer string.

>>> matches( 'hare','here')

3

>>> matches( 'pear','Plum' )

1

>>> matches( 'able', 'Abel' )

1

>>> matches( 'art', 'ARTSY' )

3

>>> matches( 'artsy', 'ART' )

3

>>> matches( 'hello!', 'good bye!')

0

>>> matches( 'Mississippi', 'Missouri' )

5

>>>

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!