The Minion Game

Sort by

recency

|

1312 Discussions

|

  • + 1 comment

    Can I understand more why it is sufficient to check the occurences of each character to keep the score, and we do not need the generate the words to check for occurrences?

  • + 0 comments

    def minion_game(string): vowels = ('A', 'E', 'I', 'O', 'U') kevin_score = 0 stuart_score = 0 len_str = len(string)

    for i in range(len_str):
        if string[i] in vowels:
            kevin_score += (len_str - i)
        else:
            stuart_score += (len_str - i)
    
    if kevin_score > stuart_score:
        print(f'Kevin {kevin_score}')
    elif stuart_score > kevin_score:
        print(f'Stuart {stuart_score}')
    else:
        print('Draw')
    

    if name == 'main': s = input() minion_game(s)

  • + 0 comments
    def minion_game(string):
        n = len(string)
        S = string.upper()          # be robust to case
        vowels = set("AEIOU")
    
        kevin = 0   # vowel player
        stuart = 0  # consonant player
    
        for i, ch in enumerate(S):
            if ch in vowels:
                kevin += n - i
            else:
                stuart += n - i
    
        if kevin > stuart:
            print(f"Kevin {kevin}")
        elif stuart > kevin:
            print(f"Stuart {stuart}")
        else:
            print("Draw")
    
  • + 0 comments

    def minion_game(string): n = len(string) S = string.upper() # be robust to case vowels = set("AEIOU")

    kevin = 0   # vowel player
    stuart = 0  # consonant player
    
    for i, ch in enumerate(S):
        if ch in vowels:
            kevin += n - i
        else:
            stuart += n - i
    
    if kevin > stuart:
        print(f"Kevin {kevin}")
    elif stuart > kevin:
        print(f"Stuart {stuart}")
    else:
        print("Draw")
    
  • + 0 comments

    who's code passed test case 4?