Advertisement
Spocoman

Easter Eggs

Feb 21st, 2022 (edited)
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. quantity = int(input())
  2. red = 0
  3. orange = 0
  4. blue = 0
  5. green = 0
  6. max_count = 0
  7. max_color = ""
  8.  
  9. for i in range(quantity):
  10.     color = input()
  11.     if color == "red":
  12.         red += 1
  13.     elif color == "orange":
  14.         orange += 1
  15.     elif color == "blue":
  16.         blue += 1
  17.     elif color == "green":
  18.         green += 1
  19.  
  20. if red > orange and red > blue and red > green:
  21.     max_count = red
  22.     max_color = "red"
  23. elif orange > blue and orange > green and orange > red:
  24.     max_count = orange
  25.     max_color = "orange"
  26. elif blue > green and blue > red and blue > orange:
  27.     max_count = blue
  28.     max_color = "blue"
  29. else:
  30.     max_count = green
  31.     max_color = "green"
  32.  
  33. print(f"Red eggs: {red}")
  34. print(f"Orange eggs: {orange}")
  35. print(f"Blue eggs: {blue}")
  36. print(f"Green eggs: {green}")
  37. print(f"Max eggs: {max_count} -> {max_color}")
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement