Advertisement
simeonshopov

Cruise games (late july exam)

Nov 5th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. import math
  2. player = input()
  3. games_count = int(input())
  4. total, game1, game2, game3, avr1, avr2, avr3 = 0, 0, 0, 0, 0, 0, 0
  5.  
  6. for i in range(1, games_count + 1):
  7.   game_name = input()
  8.   score = int(input())
  9.   if game_name == "volleyball":
  10.     score *= 1.07
  11.     game1 += 1
  12.     avr1 += score
  13.   elif game_name == "tennis":
  14.     score *= 1.05
  15.     game2 += 1
  16.     avr2 += score
  17.   elif game_name == "badminton":
  18.     score *= 1.02
  19.     game3 += 1
  20.     avr3 += score
  21.   total += score
  22.  
  23. avr1 /= game1
  24. avr2 /= game2
  25. avr3 /= game3
  26.  
  27. if avr1 >=75 and avr2 >= 75 and avr3 >= 75:
  28.   print(f"Congratulations, {player}! You won the cruise games with {math.floor(total)} points.")
  29. else:
  30.   print(f"Sorry, {player}, you lost. Your points are only {math.floor(total)}.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement