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.
def minion_game(string):
# your code goes here
alphabet_vowels = ['A', 'E', 'I', 'O', 'U']
str_len = len(string)
scorecard_kevin = [1 if string[i] in alphabet_vowels else 0 for i in iter(range(str_len)) ]
score_total = sum([*range(1,str_len+1)])
score_kevin = sum([a*b for a,b in zip(scorecard_kevin,[*range(1,str_len+1)][::-1])])
score_stuart = score_total-score_kevin
if score_stuart>score_kevin:
print("Stuart %d"%score_stuart)
elif score_stuart<score_kevin:
print("Kevin %d"%score_kevin)
else:
print("Draw")
The Minion Game
You are viewing a single comment's thread. Return to all comments →
def minion_game(string): # your code goes here alphabet_vowels = ['A', 'E', 'I', 'O', 'U']
str_len = len(string)