Advertisement
Nenogzar

02_ball_in_the_bucket

Jun 13th, 2024
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. board, size = [], 6
  2. coordinates_of_B = []
  3. shots_range = 3
  4.  
  5. for r in range(size):
  6.     line = input().split(" ")
  7.     line = [int(el) if el.isdigit() else el for el in line]
  8.     board.append(line)
  9.  
  10.     for c, el in enumerate(line):
  11.         if el == "B":
  12.             coordinates_of_B.append((r, c))
  13.             board[r][c] = 0
  14.  
  15. total_points = 0
  16.  
  17. for _ in range(shots_range):
  18.     x, y = input().strip("()").split(", ")
  19.     x, y = int(x), int(y)
  20.  
  21.     if (x, y) in coordinates_of_B:
  22.         column_sum = sum(board[r][y] for r in range(size))
  23.         total_points += column_sum
  24.  
  25. if total_points >= 300:
  26.     prize = "Lego Construction Set"
  27. elif 200 <= total_points < 300:
  28.     prize = "Teddy Bear"
  29. elif 100 <= total_points < 200:
  30.     prize = "Football"
  31. else:
  32.     prize = None
  33.  
  34. if prize:
  35.     print(f"Good job! You scored {total_points} points, and you've won {prize}.")
  36. else:
  37.     needed_points = 100 - total_points
  38.     print(f"Sorry! You need {needed_points} points more to win a prize.")
  39. # print(*board)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement