You are viewing a single comment's thread. Return to all comments →
This problem is kind a triky process AND YOU NEED TO REFRES THE CONCEPT OF COMBINATION the solution is in the for loop:
for i in range(length): if string[i] in vowels: kevin += length - i else: stuart += length - i
and understand this : posible combination of substrIng in a string that is the cycle do, so : 'B,A,N,A,N,A' 0 (get 6 substring): * 'B' , 'BA' , 'BAN' , 'BANA' , 'BANAN' , 'BANANA'* 1 (get 5 substring):** 'A' , 'AN' , 'ANA' , 'ANAN' , 'ANANA** 2 (get 4 substring): * 'N' , 'NA' , 'NAN' , 'NANA'* 3 (get 3 substring):** 'A' , 'AN' , 'ANA'** 4 (get 2 substring): * 'N' , 'NA' * 5 (get 1 substring): ** 'A'**
NOW AS you can see they start in vowey or not vowel so if you sum you get result ,
Seems like cookies are disabled on this browser, please enable them to open this website
The Minion Game
You are viewing a single comment's thread. Return to all comments →
and understand this : posible combination of substrIng in a string that is the cycle do, so : 'B,A,N,A,N,A' 0 (get 6 substring): * 'B' , 'BA' , 'BAN' , 'BANA' , 'BANAN' , 'BANANA'* 1 (get 5 substring):** 'A' , 'AN' , 'ANA' , 'ANAN' , 'ANANA** 2 (get 4 substring): * 'N' , 'NA' , 'NAN' , 'NANA'* 3 (get 3 substring):** 'A' , 'AN' , 'ANA'** 4 (get 2 substring): * 'N' , 'NA' * 5 (get 1 substring): ** 'A'**
NOW AS you can see they start in vowey or not vowel so if you sum you get result ,