Advertisement
simeonshopov

Football Tournament

Oct 11th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. name = input()
  2. number_games = int(input())
  3. w = 0
  4. d = 0
  5. l = 0
  6. total = 0
  7.  
  8. for i in range(number_games):
  9.   result = input()
  10.   if result == "W":
  11.     w += 1
  12.   elif result == "D":
  13.     d += 1
  14.   elif result == "L":
  15.     l += 1
  16.  
  17.   total = w *3 + d * 1 + l * 0
  18.  
  19. if (w + d + l) == 0:
  20.   print(f"{name} hasn't played any games during this season.")
  21. else:
  22.   print(f"{name} has won {total} points during this season.")
  23.   print("Total stats:")
  24.   print(f"## W: {w}")
  25.   print(f"## D: {d}")
  26.   print(f"## L: {l}")
  27.   print(f"Win rate: {((w / (w + d + l)) * 100):.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement