Programming, Data Structures And Algorithms Using Python - Week 5 Programming Assignment Jul-Dec 2022

     NPTEL PROGRAMMING ASSIGNMENTS

Programming, Data Structures And Algorithms Using Python

Week 5 Programming Assignment
Last Day of Submission: 1-Sep-2022

In a tennis match that is made up of sets and 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.


Winner: Loser: Set-1-score,...,Set-n-score, where 2≤ n≤ 5


The input is terminated by a blank line.

write a Python program that reads information about all the matches and compile the following statistics or items for each player:

  1. Number of best-of-5 set matches won
  2. Number of best-of-3 set matches won
  3. Number of sets won
  4. Number of games won
  5. Number of sets lost
  6. Number of games lost

print the standard output a summary in decreasing order of ranking, where the ranking is according to the statistics or criteria 1-6 in that order compare item 1, if equal compare item 2, if equal compare item 3 etc, noting that for items 5 and 6 the comparison is reversed.



Programming, Data Structures And Algorithms Using Python






 

  


Post a Comment (0)
Previous Post Next Post