Advertisement
pacho_the_python

Untitled

Oct 21st, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. command = input()
  2.  
  3. win = 0
  4. lost = 0
  5. tournament_count = 0
  6.  
  7. while command != "End":
  8.     tournaments = int(input())
  9.     for tournament in range(1, tournaments + 1):
  10.         ally_points = int(input())
  11.         enemy_points = int(input())
  12.         tournament_count += 1
  13.         difference = abs(ally_points - enemy_points)
  14.         if ally_points > enemy_points:
  15.             win += 1
  16.             print(f"Game {tournament} of tournament {command}: win with {difference} points.")
  17.         elif ally_points < enemy_points:
  18.             lost += 1
  19.             print(f"Game {tournament} of tournament {command}: lost with {difference} points.")
  20.     command = input()
  21.  
  22. win_percent = win / tournament_count * 100
  23. lost_percent = lost / tournament_count * 100
  24.  
  25. print(f"{win_percent:.2f}% matches win")
  26. print(f"{lost_percent:.2f}% matches lost")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement