Advertisement
Guest User

Untitled

a guest
May 21st, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. name_of_team = input()
  2. games_played = int(input())
  3.  
  4. win = 0
  5. draw = 0
  6. loose = 0
  7. win_count = 0
  8. draw_count = 0
  9. loose_count = 0
  10. total_points = 0
  11. percent_won = 0
  12.  
  13. if games_played <= 0:
  14.     print(f"{name_of_team} hasn't played any games during this season.")
  15.  
  16. for i in range(1, games_played + 1):
  17.     result_of_game = input()
  18.     if result_of_game == 'W':
  19.         win += 3
  20.         win_count += 1
  21.     elif result_of_game == 'D':
  22.         draw += 1
  23.         draw_count += 1
  24.     elif result_of_game == 'L':
  25.         loose += 0
  26.         loose_count += 1
  27.     total_points = win + draw
  28.     percent_won = (win_count / games_played) * 100
  29.  
  30. print(f'{name_of_team} has won {total_points} points during this season.')
  31. print('Total stats:')
  32. print(f'## W: {win_count}\n## D: {draw_count}\n## L: {loose_count}')
  33. print(f'Win rate: {percent_won:.2f}%')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement