Kevin and Stacy want to play a game they have titled 'Vowels or Not?'. Here are the game rules: Both players are given the same string, S. Both players have to make substrings using the letters of the string S. Kevin has to make substrings starting with consonants. Stacy has to make substrings starting with vowels. (Note: vowels are only defined as AEIOU, i.e., in this game, Y is not considered a vowel.) The game ends when both players have made all possible substrings. A player gets +1 point for each occurrence of the substring in the string S. For example, consider the string S= BANANA. Suppose Stacy's vowel beginning substring is ANA. In this case, ANA occurs twice in BANANA. Hence, Stacy will get 2 points for this substring. See the following figure for other examples. Your task is to determine the winner of the game and their score, given a string S. Your program should: Ask the user whether they want to provide a string for the game (choice 1) OR whether they prefer to have a randomly generated string (choice 2). If the user enters 1, ask the user to enter a string S. The user should enter a string of all uppercase letters. If the user enters 2, ask the user for a seed and then generate a random string of 6 uppercase letters. Random should be seeded as a string. You must generate the random string by creating a list/string of all 26 uppercase letters and then using random.choice() to choose 6 random characters. Output Kevin's score for the game, followed by Stacy's score for the game. Output the winner of the game (Kevin or Stacy) or state the game was a "Draw" (if their scores are the same). Your code should be able to handle any string of uppercase letters of length n (1 ≤ n ≤ 100).
Hello, I am coding in Python 3 and was given this assignment, I currently have no idea where to start and Pseudocode for this problem would be extremely helpful.
Kevin and Stacy want to play a game they have titled 'Vowels or Not?'. Here are the game rules:
- Both players are given the same string, S.
- Both players have to make substrings using the letters of the string S.
- Kevin has to make substrings starting with consonants.
- Stacy has to make substrings starting with vowels. (Note: vowels are only defined as AEIOU, i.e., in this game, Y is not considered a vowel.)
- The game ends when both players have made all possible substrings.
A player gets +1 point for each occurrence of the substring in the string S. For example, consider the string S= BANANA. Suppose Stacy's vowel beginning substring is ANA. In this case, ANA occurs twice in BANANA. Hence, Stacy will get 2 points for this substring. See the following figure for other examples. Your task is to determine the winner of the game and their score, given a string S.
Your program should:
- Ask the user whether they want to provide a string for the game (choice 1) OR whether they prefer to have a randomly generated string (choice 2).
- If the user enters 1, ask the user to enter a string S. The user should enter a string of all uppercase letters.
- If the user enters 2, ask the user for a seed and then generate a random string of 6 uppercase letters. Random should be seeded as a string. You must generate the random string by creating a list/string of all 26 uppercase letters and then using random.choice() to choose 6 random characters.
- Output Kevin's score for the game, followed by Stacy's score for the game.
- Output the winner of the game (Kevin or Stacy) or state the game was a "Draw" (if their scores are the same).
Your code should be able to handle any string of uppercase letters of length n (1 ≤ n ≤ 100).
Trending now
This is a popular solution!
Step by step
Solved in 2 steps