The Minion Game

  • + 1 comment

    what's wrong in this code ? It failed in some test cases . anyone help !

    def minion_game(string):
        # your code goes here
        stuart_score = 0
        kevin_score = 0
        vowels = tuple('AEIOU')
        for i in range(len(string)):
            sub_string = ""
            for j in range(i,len(string)):   
            #operation
                sub_string += string[j] 
                if sub_string.startswith(vowels):
                    kevin_score += 1 
                else:
                    stuart_score += 1
                          
        if stuart_score > kevin_score:   
            print(f"Stuart {stuart_score}")
        elif kevin_score > stuart_score :
            print(f"Kevin {kevin_score}")
        else:
            print("Draw")