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.
defminion_game(string):stuart=0kevin=0stuart=score_it(string,'BCDFGHJKLMNPQRSTVWXYZ')kevin=score_it(string,'AEIOU')ifstuart>kevin:print("Stuart",stuart)elifkevin>stuart:print("Kevin",kevin)else:print("Draw")defscore_it(s,starts='LETTERS'):score=0fori,cinenumerate(list(s)):ifcinstarts:score+=len(s)-i#some of the edge cases are ridiculously long#kept getting memory errors, until optimized the scoring#by just counting chars, instead of lists of substringsreturnscore
The Minion Game
You are viewing a single comment's thread. Return to all comments →