title: How to find if a list contains multiple of the same element in python?
body: <p>so I just started learning python and I get mini-lessons from my friend every week. This week was to make a simple slot machine game. There are 6 items in the slot machine, and when 3 or more of the same item show up, the user wins. I've tried the below code:</p>
  
  <pre><code>for i in slotScreen:
      if slotScreen.count(i) == 3:
          print('You got 3 of the same! You win!')
  </code></pre>
  
  <p>The code works when the first item in the list is part of the 3 of a kind, but the code doesn't work if none of the three elements are first on the list, like below:</p>
  
  <pre><code>slotScreen = ['lemon', 'cherry', 'lemon', 'lemon', 'pirate', 'bar']  # works
  
  slotScreen = ['cherry', 'lemon', 'lemon', 'lemon', 'pirate', 'bar']  # not work
  </code></pre>
  
  <p>Any idea why this happens?</p>
  
  <p>EDIT: More code. I get the You Lose message when I should be getting the You win 3x message.</p>
  
  <pre><code>        for i in slotScreen:
              if slotScreen.count(i) == 6:
                  print('You win 10x your bet!!!')
                  x = x + int(bet) * 10
                  break
  
              elif slotScreen.count(i) == 5:
                  print('You win 5x your bet!')
                  x = x + int(bet) * 5
                  break
  
              elif slotScreen.count(i) == 4:
                  print('You win 4x your bet!')
                  x = x + int(bet) * 4
                  break
  
              elif slotScreen.count(i) == 3:
                  print('You win 3x your bet!')
                  x = x + int(bet) * 3
                  break
  
              elif slotScreen.count(i) &lt;= 2:
                  print('Sorry you lose')
                  break
  </code></pre>