Entry tags:
Lecture 7 / PS4 Start
Links:
- Lecture 7 (spans May 3–May 16, 2010):
- Assignment
I'll be posting the remaining solutions over the next few days, as soon as I have time to finish reviewing them.
# Problem 1: countSubstringMatch, countSubstringMatchRecursive def countSubStringMatch( target, key ): count = 0 while target.find( key ) > -1: count += 1 target = target[target.find( key ) + len( key ):] return count def countSubStringMatchRecursive( target, key ): if target.find( key ) < 0: return 0 else: return 1 + countSubStringMatchRecursive( target[(target.find( key ) + len(key)):], key )