Advertisement
yordan_yordanov

05. Tennis Ranklist

Aug 24th, 2020
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. import math
  2.  
  3. tournaments = int(input())
  4. starting_points = int(input())
  5.  
  6. tournament = 0
  7. points = starting_points
  8. average_points = 0
  9. tournaments_won = 0
  10.  
  11. while tournament <= tournaments:
  12.     result = input()
  13.  
  14.     percentage_won = (tournaments_won / tournaments) * 100
  15.  
  16.     if tournament == tournaments:
  17.         print(f'Final points: {points}')
  18.         print(f'Average points: {math.floor(average_points / tournaments)}')
  19.         print(f'{percentage_won:.2f}%')
  20.  
  21.     if result == 'W':
  22.         points += 2000
  23.         average_points += 2000
  24.         tournaments_won += 1
  25.         tournament += 1
  26.     elif result == 'F':
  27.         points += 1200
  28.         average_points += 1200
  29.         tournament += 1
  30.     elif result == 'SF':
  31.         points += 720
  32.         average_points += 720
  33.         tournament += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement