Advertisement
exDotaPro

27_july_2019_5_cruise_games

Jan 5th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. from math import floor as fl
  2.  
  3. player_name = input()
  4. games_played = int(input())
  5.  
  6. volleyball_games = 0
  7. tennis_games = 0
  8. badminton_games = 0
  9.  
  10. volleyball_score = 0
  11. tennis_score = 0
  12. badminton_score = 0
  13.  
  14. for i in range(games_played):
  15.     game_name = input()
  16.     score = int(input())
  17.  
  18.     if game_name == 'volleyball':
  19.         volleyball_games += 1
  20.         score *= 1.07
  21.         volleyball_score += score
  22.        
  23.     elif game_name == 'tennis':
  24.         tennis_games += 1
  25.         score *= 1.05
  26.         tennis_score += score
  27.        
  28.     elif game_name == 'badminton':
  29.         badminton_games += 1
  30.         score *= 1.02
  31.         badminton_score += score
  32.  
  33. average_volleyball_score = fl(volleyball_score / volleyball_games)
  34. average_tennis_score = fl(tennis_score / tennis_games)
  35. average_badminton_score = fl(badminton_score / badminton_games)
  36. total_score = fl(volleyball_score + tennis_score + badminton_score)
  37.  
  38. if average_volleyball_score >= 75 and average_tennis_score >= 75 and average_badminton_score >= 75:
  39.     print(f'Congratulations, {player_name}! You won the cruise games with {total_score} points.')
  40. else:
  41.     print(f'Sorry, {player_name}, you lost. Your points are only {total_score}.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement