The Minion Game

  • + 3 comments

    python3

    def minion_game(string):
        # Initialize the scores for Kevin and Stuart
        kevin_score = 0
        stuart_score = 0
        
        # Get the length of the string
        n = len(string)
        
        # Loop through each character in the string
        for i in range(n):
            # If the character is a vowel, add points to Kevin's score
            if string[i] in 'AEIOU':
                kevin_score += n - i
            # If the character is a consonant, add points to Stuart's score
            else:
                stuart_score += n - i
        
        # Determine and announce the winner
        if kevin_score > stuart_score:
            print("Kevin", kevin_score)
        elif kevin_score < stuart_score:
            print("Stuart", stuart_score)
        else:
            print("Draw")
    
    
    if __name__ == '__main__':
        s = input()
        minion_game(s)