Ananyasingh2002 / Hacktoberfest2023

Join Hacktoberfest 2023: Contribute to open source, learn, and earn rewards. Beginner-friendly. Explore issues, fork, code, and make a global impact. Let's collaborate!
https://ananyasingh2002.github.io/Hacktoberfest2023/
145 stars 1.22k forks source link

minion_game #766

Open Devika-H opened 1 year ago

Devika-H commented 1 year ago

Here's how the code works:

  1. Define the minion_game function, which takes a string as input.

  2. Initialize kevin_score and stuart_score to keep track of the scores for Kevin and Stuart, respectively.

  3. Calculate the length of the input string length.

  4. Loop through the characters in the string and determine whether they are vowels (Kevin) or consonants (Stuart). For each character, calculate the number of substrings that start with that character and add that count to the respective player's score.

  5. After calculating the scores, compare them to decide the winner. Print the winner's name and score or "Draw" if the scores are equal.

  6. In the main part of the code, read the input string from the user and call the minion_game function to determine the winner and display the result.