Guest User

Untitled

a guest
Nov 2nd, 2019
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. import math
  2. name = input()
  3. games = int(input())
  4.  
  5.  
  6. volleycounter = 0
  7. tenniscounter =0
  8. badmin = 0
  9. volleyscore = 0.0
  10. tennisscore = 0.0
  11. badminscore = 0.0
  12. pointscounter = 0.0
  13. for i in range(games):
  14.     nameGame = input()
  15.     points = int(input())
  16.  
  17.     if nameGame == "volleyball":
  18.         volleyscore += points + (0.07 * points)
  19.         volleycounter += 1
  20.     elif nameGame == "tennis":
  21.         tennisscore += points + (0.05 * points)
  22.         tenniscounter +=1
  23.     elif nameGame == "badminton":
  24.         badminscore += points + (0.02 * points)
  25.         badmin += 1
  26.  
  27. sum = volleyscore + tennisscore + badminscore
  28. volleyscore = math.floor(volleyscore / volleycounter)
  29. tennisscore = math.floor(tennisscore / tenniscounter)
  30. badminscore = math.floor(badminscore / badmin)
  31.  
  32.  
  33. #winner = bool(volleyscore >= 75 and tennisscore >= 75 and badminscore >= 75)
  34.  
  35. if volleyscore >= 75 and tennisscore >= 75 and  badminscore >= 75:
  36.     print(f'Congratulations, {name}! You won the cruise games with {math.floor(sum)} points.')
  37. else:
  38.     print(f"Sorry, {name}, you lost. Your points are only {math.floor(sum)}.")
Advertisement
Add Comment
Please, Sign In to add comment