Advertisement
Guest User

06. Tournament of Christmas

a guest
Jun 18th, 2021
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. tournament_duration = int(input())
  2. tournament_over = False
  3. days_count = 0
  4. daily_money = 0
  5. total_money = 0
  6. daily_wins = 0
  7. daily_losses = 0
  8. total_wins = 0
  9. total_losses = 0
  10.  
  11. while not tournament_over:
  12.     while days_count <= tournament_duration:
  13.  
  14.         command = input()
  15.         if command == "Finish":
  16.             break
  17.  
  18.         result = input()
  19.         if result == "win":
  20.             daily_money += 20
  21.             daily_wins += 1
  22.             total_wins += 1
  23.         elif result == "lose":
  24.             daily_losses += 1
  25.             total_losses += 1
  26.  
  27.     if daily_wins > daily_losses:
  28.         daily_money *= 1.1
  29.     elif daily_wins < daily_losses:
  30.         tournament_over = False
  31.  
  32.     total_money += daily_money
  33.     daily_wins = 0
  34.     daily_losses = 0
  35.     daily_money = 0
  36.     days_count += 1
  37.  
  38.     if days_count < tournament_duration:
  39.         tournament_over = False
  40.         continue
  41.     else:
  42.         tournament_over = True
  43.         break
  44.  
  45. if total_wins > total_losses:
  46.     total_money *= 1.2
  47.     print(f"You won the tournament! Total raised money: {total_money:.2f}")
  48. else:
  49.     print(f"You lost the tournament! Total raised money: {total_money:.2f}")
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement