Sichanov

easter eggs

Jul 18th, 2021
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. number_of_red_eggs = 0
  2. number_of_orange_eggs = 0
  3. number_of_blue_eggs = 0
  4. number_of_green_eggs = 0
  5. number_of_max_eggs_from_same_color = 0
  6. color_of_max_eggs = ''
  7.  
  8. number_of_eggs = int(input())
  9. for current_egg in range(number_of_eggs):
  10.     color_of_current_egg = input()
  11.     if color_of_current_egg == 'red':
  12.         number_of_red_eggs += 1
  13.         if number_of_red_eggs > number_of_max_eggs_from_same_color:
  14.             color_of_max_eggs = 'red'
  15.             number_of_max_eggs_from_same_color = number_of_red_eggs
  16.     elif color_of_current_egg == 'orange':
  17.         number_of_orange_eggs += 1
  18.         if number_of_orange_eggs > number_of_max_eggs_from_same_color:
  19.             color_of_max_eggs = 'orange'
  20.             number_of_max_eggs_from_same_color = number_of_orange_eggs
  21.     elif color_of_current_egg == 'blue':
  22.         number_of_blue_eggs += 1
  23.         if number_of_blue_eggs > number_of_max_eggs_from_same_color:
  24.             color_of_max_eggs = 'blue'
  25.             number_of_max_eggs_from_same_color = number_of_blue_eggs
  26.     elif color_of_current_egg == 'green':
  27.         number_of_green_eggs += 1
  28.         if number_of_green_eggs > number_of_max_eggs_from_same_color:
  29.             color_of_max_eggs = 'green'
  30.             number_of_max_eggs_from_same_color = number_of_green_eggs
  31. print(f"Red eggs: {number_of_red_eggs}")
  32. print(f"Orange eggs: {number_of_orange_eggs}")
  33. print(f"Blue eggs: {number_of_blue_eggs}")
  34. print(f"Green eggs: {number_of_green_eggs}")
  35. print(f"Max eggs: {number_of_max_eggs_from_same_color} -> {color_of_max_eggs}")
Advertisement
Add Comment
Please, Sign In to add comment