We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Strings
- The Minion Game
- Discussions
The Minion Game
The Minion Game
Sort by
recency
|
1306 Discussions
|
Please Login in order to post a comment
What i miss? Frequency dictionary for "BANANANAAAS"
{'A': 6, 'AN': 3, 'ANA': 3, 'ANAN': 2, 'ANANA': 2, 'ANANAN': 1, 'ANANANA': 1, 'ANANANAA': 1, 'ANANANAAA': 1, 'ANANANAAAS': 1, 'ANANAA': 1, 'ANANAAA': 1, 'ANANAAAS': 1, 'ANAA': 1, 'ANAAA': 1, 'ANAAAS': 1, 'AA': 2, 'AAA': 1, 'AAAS': 1, 'AAS': 1, 'AS': 1} total 33
{'B': 1, 'BA': 1, 'BAN': 1, 'BANA': 1, 'BANAN': 1, 'BANANA': 1, 'BANANAN': 1, 'BANANANA': 1, 'BANANANAA': 1, 'BANANANAAA': 1, 'BANANANAAAS': 1, 'N': 3, 'NA': 3, 'NAN': 2, 'NANA': 2, 'NANAN': 1, 'NANANA': 1, 'NANANAA': 1, 'NANANAAA': 1, 'NANANAAAS': 1, 'NANAA': 1, 'NANAAA': 1, 'NANAAAS': 1, 'NAA': 1, 'NAAA': 1, 'NAAAS': 1} 32
def minion_game(string): vowels = "AEIOU"
My code:
def minion_game(string):
if name == 'main': s = input() minion_game(s)
def minion_game(string): # your code goes here Stuart = 0 Kevin = 0 #vowels = ['a','e','i','o','u','A','E','I','O','U'] vowels = ['A','E','I','O','U'] vowels= set(vowels) #vowels = set('A','E','I','O','U') if len(string) > 0 and len(string) <= 1000000: for i in range(1,len(string)+1): for j in range(0,(len(string)+1)-i): if string[j] in vowels: Kevin = Kevin +1 else: Stuart=Stuart+1 if Kevin > Stuart: print("Kevin {}".format(Kevin)) elif Kevin < Stuart: print("Stuart {}".format(Stuart)) else: print('Draw')