Issue with my word score function
<p>So here is my code:</p>

<pre><code>def word_score(string1, string2):    
    '''Returns the word score for two strings'''    
    if len(string1) == 0 or len(string2) == 0:    
        return 0    
    else:    
        if string1[0] in string2:                
            return 1 + word_score(string1[1:], string2)    
        else:    
            return word_score(string1[1:], string2)  
</code></pre>

<p>Basically for every letter that is shared between each string the score should increase by one. However there should not be repeats but my code repeats letters sometimes depending on the output. I have to use recursion for this and can't using anything like map or key because we haven't learned that yet in class. This lab assignment is really tricky and I tried debugging and all my classmates are stumped and its due on Tuesday. </p>

<p>Heres some outputs that don't work and what they should be returning:    </p>

<p><code>word_score('always', 'walking')</code> returns 4 but should return 3 because of the repeat there is one extra</p>

<p><code>word_score('recursion', 'excursion')</code> returns 9 but should return 8 again because of the repeat</p>

<p>Correct outputs:</p>

<p><code>word_score('diner', 'syrup')</code> correctly returns 1</p>

<p><code>word_score('always', 'bananas')</code> correctly returns 3</p>

<p>You can try to "erase" the letters from the second word, when a "positive match" occurs. 
This way, your duplicate issues will disappear. </p>

python recursion