Advertisement
vencinachev

Basketball

Feb 19th, 2022
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. name_tournament=input()
  2. #number_of_games=int(input())
  3. games_counter=0
  4. victories=0
  5. losses=0
  6.  
  7. while name_tournament != "End of tournaments":
  8.  
  9.     current_tournament = name_tournament
  10.     number_of_games = int(input())
  11.  
  12.     for game in range (number_of_games):
  13.         points_desi=int(input())
  14.         points_opponent=int(input())
  15.         games_counter += 1
  16.  
  17.         if points_desi > points_opponent:
  18.             victories += 1
  19.             difference = abs(points_desi - points_opponent)
  20.             print(f"Game {games_counter} of tournament {name_tournament}: win with {difference} points.")
  21.         elif points_desi < points_opponent:
  22.             losses += 1
  23.             difference= abs(points_desi - points_opponent)
  24.             print(f"Game {games_counter} of tournament {name_tournament}: lost with {difference} points.")
  25.  
  26.     name_tournament = input()
  27.  
  28. percentage_victories = victories / games_counter * 100
  29. percentage_losses = losses / games_counter * 100
  30.  
  31. print(f"{percentage_victories:.2f}% matches win")
  32. print(f"{percentage_losses:.2f}% matches lost")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement