Advertisement
Nenogzar

04. Balls

Apr 9th, 2024
846
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. import math
  2.  
  3. number_balls = int(input())
  4. color_points = 0
  5. color_info = {
  6.     "Red": [5, 0],
  7.     "Orange": [10, 0],
  8.     "Yellow": [15, 0],
  9.     "White": [20, 0],
  10.     "Black": [0.5, 0],
  11.     "Other_color": [0, 0]
  12. }
  13.  
  14. for _ in range(number_balls):
  15.     color = input().capitalize()
  16.     if color == "Black":
  17.         color_info["Black"][1] += 1
  18.         points = color_info["Black"][0]
  19.         color_points = math.floor(color_points * points)
  20.     elif color in color_info:
  21.         color_points += color_info[color][0]
  22.         color_info[color][1] += 1
  23.     else:
  24.         color_info["Other_color"][1] += 1
  25.  
  26. print(f"Total points: {color_points}")
  27. for color in color_info:
  28.     if color != "Black" and color != "Other_color":
  29.         print(f"{color} balls: {color_info[color][1]}")
  30. print(f"Other colors picked: {color_info['Other_color'][1]}")
  31. print(f"Divides from black balls: {color_info['Black'][1]}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement