0

Please explain the logic

Need the exact logic behind https://code.sololearn.com/cMg6df1E7Y2l/?ref=app

11th Feb 2020, 2:54 PM
Vasif Afzal
Vasif Afzal - avatar
1 Answer
0
d={'player1':0,"player2":0} def sample(s): s1=s[:] if len(s)!=0: return sample2(s,s1) else: return d def sample2(s,s1): if len(s)!=0: if s.startswith(('a','e','i','o','u')): d['player2']+=1 else: d['player1']+=1 return sample2(s[:len(s)-1],s1) else: return sample(s1[1:]) s='cabbage' print(sample(s))
11th Feb 2020, 2:55 PM
Vasif Afzal
Vasif Afzal - avatar