HackerRank Python - The Minion Game




Determine the winner of The Minion Game and their score.

Problem Link - https://www.hackerrank.com/challenges/the-minion-game/problem



  1. def minion_game(string):
  2. # your code goes here
  3. vw = 'aeiou'.upper()
  4. strl = len(string)
  5. kevin = sum(strl-i for i in range(strl) if string[i] in vw)
  6. stuart = strl*(strl + 1)/2 - kevin
  7. if kevin == stuart:
  8. print ('Draw')
  9. elif kevin > stuart:
  10. print ('Kevin %d' % kevin)
  11. else:
  12. print ('Stuart %d' % stuart)
  13. if __name__ == '__main__':
  14. s = input()
  15. minion_game(s)




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube