The Minion Game - Python string problem solution

Author: Al-mamun Sarkar Date: 2020-03-23 21:01:10

The Minion Game - Python string problem solution. This is a solution to the HackerRank Python string problem. Click here to see the problem.

Code:


def minion_game(string):
	vowels = 'AEIOU';
	keysc = 0
	stusc = 0
	for i in range( 0, len(string) ):
		if string[i] in vowels:
			keysc += len(string) - i
		else:
			stusc += len(string) - i

	if keysc > stusc:
		print('Kevin {}'.format(keysc))
	elif stusc > keysc:
		print( 'Stuart {}'.format(stusc) )
	else:
		print('Draw')


if __name__ == '__main__':
    s = input()
    minion_game(s)

 

Test Input:

BANANA

Test Output:

Stuart 12