Advertisement
Spocoman

Cruise Games

Oct 6th, 2023
961
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. gamer = input()
  2. games = int(input())
  3.  
  4. volleyballGames = 0
  5. volleyballScores = 0.0
  6. tennisGames = 0
  7. tennisScores = 0.0
  8. badmintonGames = 0
  9. badmintonScores = 0.0
  10.  
  11. for i in range(games):
  12.     game = input()
  13.     score = int(input())
  14.  
  15.     if game == "volleyball":
  16.         volleyballGames += 1
  17.         volleyballScores += score * 1.07
  18.     elif game == "tennis":
  19.         tennisGames += 1
  20.         tennisScores += score * 1.05
  21.     else:
  22.         badmintonGames += 1
  23.         badmintonScores += score * 1.02
  24.  
  25. averageVolleyballPoints = int(volleyballScores / volleyballGames)
  26. averageTennisPoints = int(tennisScores / tennisGames)
  27. averageBadmintonPoints = int(badmintonScores / badmintonGames)
  28. totalPoints = int(volleyballScores + tennisScores + badmintonScores)
  29.  
  30. if averageVolleyballPoints >= 75 and averageTennisPoints >= 75 and averageBadmintonPoints >= 75:
  31.     print(f"Congratulations, {gamer}! You won the cruise games with {totalPoints} points.")
  32. else:
  33.     print(f"Sorry, {gamer}, you lost. Your points are only {totalPoints}.")
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement