Question
PYTHON 2. Write a function matches that accepts two strings as arguments. The function then returns the number of times that the two strings have
PYTHON
2. 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
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