The Minion Game

Sort by

recency

|

1300 Discussions

|

  • + 1 comment

    The Minion Game is an exciting and quick word game that challenges your thinking abilities. It’s a great way to pass the time while keeping your mind active. If you like this type of game, you may also enjoy the Sikkim Game, which makes things even more fun with opportunities to win rewards. Website: https://sikkimgames.io/

  • + 0 comments

    The Minion Game is a fun and fast-paced word game that tests your thinking skills. It’s great for passing time and keeping your mind sharp. If you enjoy games like this, you might also like the Raja Luck Game, which adds excitement with chances to win rewards.

  • + 0 comments

    Use a set to search for vowels, O(1) instead of O(n), n = |vowels| Also single loop instead of two loops i.e. list comprehensions.

    def minion_game(string):
        # your code goes here
        vowels = set()
        [vowels.add(x) for x in 'AEIOU']
        slen = len(string)
        volscore = 0
        conscore = 0
        for i in range(slen):
            n = slen - i
            if s[i] in vowels:
                volscore += n
            else:
                conscore += n
        if conscore > volscore:
            print(f"Stuart {conscore}")
        elif conscore < volscore:
            print(f"Kevin {volscore}")
        else:
            print("Draw")
                
    
    if __name__ == '__main__':
        s = input()
        minion_game(s
    
  • + 1 comment

    Cleaner solution:

    def minion_game(string):
        vowels, n = 'AEIOU', len(string)
        stuart = sum([n - i for i in range(0, n) if string[i] not in vowels])
        kevin = sum([n - i for i in range(0, n) if string[i] in vowels])
    
        diff = stuart - kevin
        if diff > 0:
            print(f"Stuart {stuart}")
        elif diff < 0:
            print(f"Kevin {kevin}")
        else:
            print("Draw")
    
  • + 0 comments
        kevin_score = stuart_score = 0
        length = len(string)
        count = 0
        for c in string:
            if c in 'AEIOU':
                kevin_score += (length - count)
            else:
                stuart_score += (length - count)
            # string = string[1:]
            count += 1
    
        if (kevin_score > stuart_score):
            print(f'Kevin {kevin_score}')
        elif (stuart_score > kevin_score):
            print(f'Stuart {stuart_score}')
        else:
            print('Draw')