Advertisement
Spocoman

Balls

Jan 5th, 2022 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. balls_num = int(input())
  2. total_points = 0
  3. red = 0
  4. orange = 0
  5. yellow = 0
  6. white = 0
  7. black = 0
  8. other = 0
  9.  
  10. for i in range(balls_num):
  11.     ball = input()
  12.     if ball == 'red':
  13.         red += 1
  14.         total_points += 5
  15.     elif ball == 'orange':
  16.         orange += 1
  17.         total_points += 10
  18.     elif ball == 'yellow':
  19.         yellow += 1
  20.         total_points += 15
  21.     elif ball == 'white':
  22.         white += 1
  23.         total_points += 20
  24.     elif ball == 'black':
  25.         black += 1
  26.         total_points /= 2
  27.     else:
  28.         other += 1
  29.  
  30. print(f'Total points: {int(total_points)}')
  31. print(f'Red balls: {red}')
  32. print(f'Orange balls: {orange}')
  33. print(f'Yellow balls: {yellow}')
  34. print(f'White balls: {white}')
  35. print(f'Other colors picked: {other}')
  36. print(f'Divides from black balls: {black}')
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement