Advertisement
ALEXANDAR_GEORGIEV

tennis_ranklist

Jun 17th, 2022
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. from math import floor
  2. count_tournaments = int(input())
  3. start_scores = int(input())
  4. check_count_tours = count_tournaments
  5. list_scores = []
  6. list_w = []
  7. list_f = []
  8. list_sf = []
  9. while check_count_tours != 0:
  10.     level = input()
  11.     if level == 'W':
  12.         list_w.append(2000)
  13.         list_scores.append(2000)
  14.     elif level == 'F':
  15.         list_f.append(1200)
  16.         list_scores.append(1200)
  17.     elif level == 'SF':
  18.         list_sf.append(720)
  19.         list_scores.append(720)
  20.     check_count_tours -= 1
  21.  
  22. total_scores = start_scores + sum(list_w) + sum(list_f) + sum(list_sf)
  23. len_list_scores = len(list_scores)
  24. sum_list_scores = sum(list_scores)
  25. average_scores = sum_list_scores / len_list_scores
  26. len_list_w = len(list_w)
  27. percent_tours = (len_list_w / len_list_scores) * 100
  28.  
  29. print(f"Final points: {total_scores}")
  30. print(f"Average points: {floor(average_scores)}")
  31. print(f"{percent_tours:.2f}%")
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement