Give the status of the tennis game
Description:
Anna and Bob are playing tennis, they want you to show the result of their game.
A game is won when a player scores four (or more) points: 15, 30, 40 and the game-winning point.
Should both players make it 40, then the score is called "DEUCE". Following deuce, a player must win two consecutive points: the first point, known as "advantage" and the game-winning point. *IMPORTANT : If the opposing player scores the next point when the player has the advantage, the game once again heads to deuce.
- 1 point = 15
- 2 points = 30
- 3 points = 40
- 40-40 = Deuce
- Server wins deuce point = Ad-In
- Receiver wins deuce point = Ad-Out
Array wins is given like following : wins = ["Anna","Bob","Anna"] (should return "Bob 15, Anna 30", Bob always goes first). Note that wins is never an empty array.
Write a function get_status(wins) which returns the result as a string as following :
- "DEUCE" when there is Deuce (40-40, or like said above)
- "30a" when both players have 30 and "15a" when both players have 15
- "Anna ADVANTAGE" when there is Deuce and Anna (for example) has scored
- "Bob WINS" when Bob (for example) has the advantage and scored
- or simply "Bob 15, Anna 30" for other cases
*NOTE : When a player has won, even if the other player has scored after, the winner is the winner (ex: get_status(["Bob","Anna","Bob","Anna","Bob","Anna","Bob","Bob","Anna"]) should return "Bob WINS")
Similar Kata:
Stats:
Created | May 23, 2022 |
Published | May 23, 2022 |
Warriors Trained | 196 |
Total Skips | 2 |
Total Code Submissions | 638 |
Total Times Completed | 67 |
Python Completions | 67 |
Total Stars | 7 |
% of votes with a positive feedback rating | 88% of 26 |
Total "Very Satisfied" Votes | 20 |
Total "Somewhat Satisfied" Votes | 6 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 16 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |