title: Explanation for len(set())
body: <p>Quick question, I was coding a small program in Python and was looking for a way to make a condition to only allow the input of 4 numbers if that input has the same len that I want and to make sure that all the numbers in it are unique.
  After searching for a bit on the web I found several people giving the same solution, it was <code>len(set(input)) == size</code> (size of my number) in my case.</p>
  
  <p>It works well, but I fail to understand how it really works and I want to know.
  I've also tried removing the <code>len</code> from that and it worked anyway so I have little clue what are the effects of each thing in this small piece of code.</p>
  
  <p>So even though it allows me to create a condition that makes sure each of the 4 numbers are unique I would love it if someone could explain to me how it works.</p>
  
  <p>Thanks in advance.</p>
  
  <p>PS: If anyone wonders what it is I'm practicing by making my own version of Cows &amp; Bulls. So given a random number using random.sample the user then has to try to guess what the number is. The conditions I mentioned were used upon the user's input.</p>