Advertisement
Spocoman

08. Tennis Ranklist

Dec 25th, 2021 (edited)
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. tournament_number = int(input())
  2. points = int(input())
  3. tournament_points = 0
  4. win = 0
  5.  
  6. for i in range(tournament_number):
  7.     tournament = input()
  8.     if tournament == 'W':
  9.         tournament_points += 2000
  10.         win += 1
  11.     elif tournament == 'F':
  12.         tournament_points += 1200
  13.     elif tournament == 'SF':
  14.         tournament_points += 720
  15.  
  16. print(f'Final points: {points + tournament_points}')
  17. print(f'Average points: {int(tournament_points / tournament_number)}')
  18. print(f'{win / tournament_number * 100:.2f}%')
  19.  
  20.  
  21. Фундаменталс решение:
  22.  
  23. tournament_number = int(input())
  24. points = int(input())
  25. tournament_points = 0
  26. win = 0
  27.  
  28. for i in range(tournament_number):
  29.     tournament = input()
  30.     tournament_points += {'W': 2000, 'F': 1200, 'SF': 720}[tournament]
  31.     if tournament == 'W':
  32.         win += 1
  33.  
  34. print(f'Final points: {points + tournament_points}\n'
  35.       f'Average points: {int(tournament_points / tournament_number)}\n'
  36.       f'{win / tournament_number * 100:.2f}%')
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement