Advertisement
Guest User

Untitled

a guest
Dec 1st, 2019
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. name_of_tournament = input()
  2. number_of_games = int(input())
  3. points_for_winning = 0
  4. win_counter = 0
  5. loss_counter = 0
  6. game_counter = 0
  7. input_text = input()
  8.  
  9. while input_text != "End of tournaments":
  10.     desi_team = int(input_text)
  11.     other_team = int(input())
  12.     game_counter += 1
  13.  
  14.     if desi_team > other_team:
  15.         points_for_winning += abs(desi_team - other_team)
  16.         win_counter += 1
  17.         print(f"Game {win_counter} of tournament {name_of_tournament}: win with {points_for_winning}")
  18.         points_for_winning = 0
  19.     else:
  20.         points_for_winning += abs(desi_team - other_team)
  21.         loss_counter += 1
  22.         print(f"Game {loss_counter} of tournament {name_of_tournament} lost with {points_for_winning}")
  23.         points_for_winning = 0
  24.  
  25.     input_text = input()
  26.  
  27. win_perc = win_counter / game_counter * 100
  28. loss_perc = loss_counter / game_counter * 100
  29.  
  30. if input_text == "End of tournaments":
  31.     print(f"{win_perc:.2f}% matches win")
  32.     print(f"{loss_perc:.2ff}% matches lost")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement