Advertisement
exDotaPro

9_march_2019_6_basketball_tournament

Jan 10th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. import math
  2.  
  3. desi_team_wins = 0
  4. enemy_team_wins = 0
  5. total_games = 0
  6.  
  7. command = input()
  8.  
  9. while command != 'End of tournaments':
  10.     tournament_name = command
  11.  
  12.     games = int(input())
  13.  
  14.     for number in range(1, games + 1):
  15.         desi_team_points = int(input())
  16.         enemy_team_points = int(input())
  17.         total_games += 1
  18.  
  19.         if desi_team_points > enemy_team_points:
  20.             desi_team_wins += 1
  21.             print(f'Game {number} of tournament {tournament_name}: win with {desi_team_points - enemy_team_points} points.')
  22.  
  23.         elif enemy_team_points > desi_team_points:
  24.             enemy_team_wins += 1
  25.             print(f'Game {number} of tournament {tournament_name}: lost with {enemy_team_points - desi_team_points} points.')
  26.  
  27.     command = input()
  28.  
  29.     if command == 'End of tournaments':
  30.         percentage_won_games = (desi_team_wins / total_games) * 100
  31.         percentage_lost_games = (enemy_team_wins / total_games) * 100
  32.         print(f'{percentage_won_games:.2f}% matches win')
  33.         print(f'{percentage_lost_games:.2f}% matches lost')
  34.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement