Posts

Showing posts with the label tennis problem

Tennis Scoreboard Problem in Python

Image
Problem Definition : Here are some basic facts about tennis scoring: A tennis match is made up of sets.  A set is made up of games. To win a set, a player has to win 6 games with a difference of 2 games.  At 6-6, there is often a special tie-breaker.  In some cases, players go on playing till one of them wins the set with a difference of two games. Tennis matches can be either 3 sets or 5 sets.  The player who wins a majority of sets wins the match (i.e., 2 out 3 sets or 3 out of 5 sets) The score of a match lists out the games in each set, with the overall winner's score reported first for each set.  Thus, if the score is 6-3, 5-7, 7-6 it means that the first player won the first set by 6 games to 3, lost the second one 5 games to 7 and won the third one 7 games to 6 (and hence won the overall match as well by 2 sets to 1). You will read input from the keyboard (standard input) containing the results of several tennis matches.  Each ...