We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defminion_game(string):# Initialize the scores for Kevin and Stuartkevin_score=0stuart_score=0# Get the length of the stringn=len(string)# Loop through each character in the stringforiinrange(n):# If the character is a vowel, add points to Kevin's scoreifstring[i]in'AEIOU':kevin_score+=n-i# If the character is a consonant, add points to Stuart's scoreelse:stuart_score+=n-i# Determine and announce the winnerifkevin_score>stuart_score:print("Kevin",kevin_score)elifkevin_score<stuart_score:print("Stuart",stuart_score)else:print("Draw")if__name__=='__main__':s=input()minion_game(s)
The Minion Game
You are viewing a single comment's thread. Return to all comments →
python3