Question: Python, please use simple code as far as possible # Specification: wordOvlp(w1, w2) takes two strings, w1 and w2, and # returns an integer representing

Python, please use simple code as far as possible

# Specification: wordOvlp(w1, w2) takes two strings, w1 and w2, and # returns an integer representing the percentage of letters appearing # in both w1 and w2 with respect to the longer of w1 and w2. # # Example: # >>> wordOvlp('computer', 'science') # 25 # >>> wordOvlp('raise','mouth') # 0 # >>> wordOvlp('gamma', 'lambda') # 33 # # Hint: duplicate characters that appear in both words count only # once. Thus while 'gamma' and 'lambda' share an 'm' and 2 'a's, the # percentage is calculated as 2/6 or 33%. # # Note: solutions that use iteration (e.g., for, while or similar) # will not earn any credit.

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 Programming Questions!