Advertisement
Spocoman

Basketball Tournament

Jan 7th, 2022 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. win = 0
  2. lost = 0
  3. tournament = input()
  4.  
  5. while tournament != 'End of tournaments':
  6.     games = int(input())    
  7.     for game in range(1, games + 1):
  8.         team1 = int(input())
  9.         team2 = int(input())
  10.         if team1 > team2:
  11.             print(f'Game {game} of tournament {tournament}: win with {team1 - team2} points.')
  12.             win += 1
  13.         else:
  14.             print(f'Game {game} of tournament {tournament}: lost with {team2 - team1} points.')
  15.             lost += 1
  16.            
  17.     tournament = input()
  18.  
  19. print(f'{win / (win + lost) * 100:.2f}% matches win')
  20. print(f'{lost / (win + lost) * 100:.2f}% matches lost')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement