Advertisement
svephoto

Tennis Ranklist [python]

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