From 10a71c25fff3d539b8c6d5b54526cecb0711f4dd Mon Sep 17 00:00:00 2001 From: AKBARVE04 <118174073+AKBARVE04@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:21:35 +0530 Subject: [PATCH] Create MinionGame.py --- Hackerrank/MinionGame.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Hackerrank/MinionGame.py diff --git a/Hackerrank/MinionGame.py b/Hackerrank/MinionGame.py new file mode 100644 index 00000000..e691eae2 --- /dev/null +++ b/Hackerrank/MinionGame.py @@ -0,0 +1,19 @@ +def minion_game(string): + vowels = ["A", "E", "I", "U", "O", "a", "e", "i", "u", "o"] + kevin_score = 0 + stuart_score = 0 + for i in range(len(string)): + if string[i] in vowels: + score = len(string) - i + kevin_score += score + else: + score = len(string) - i + stuart_score += score + + if kevin_score > stuart_score: + print("Kevin", kevin_score) + elif stuart_score > kevin_score: + print("Stuart", stuart_score) + else: + print("Draw") +