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
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