PS3: Problem 1 » Solutions
May. 3rd, 2010 03:17 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.png)
I'll be posting the remaining solutions over the next few days, as soon as I have time to finish reviewing them.
PS3: Problem 1 » Solutions
# 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 )