title: What is the difference between the random.choices() and random.sample() functions?
body: <p>I have the following list: <code>list = [1,1,2,2]</code>.</p>
  
  <p>After applying the <code>sample</code> method (<code>rd.sample(list, 3)</code>) the, output is <code>[1, 1, 2]</code>.</p>
  
  <p>After applying the <code>choices</code> method (<code>rd.choices(list, 3)</code>), the output is: <code>[2, 1, 2]</code>.</p>
  
  <p>What is the difference between these two methods? When should one be preferred over the other?</p>