The Minion Game

  • + 0 comments
    from collections import Counter
    
    vowels = "AEIOU"
    
    def minion_game(txt):
        # your code goes here
        length = len(txt)
        score = Counter()
        for i, ch in enumerate(txt):
            points = length - i
            score[ch in vowels] += points  
        # print(score)
        
        if (kevin := score[True]) > (stuart := score[False]):
            print(f"Kevin {kevin}")
        elif stuart > kevin:
            print(f"Stuart {stuart}")
        else:
            print("Draw")
                
    # Input (stdin)
    # BANANA
    # Expected Output
    # Stuart 12