title: Python program that calculates the probability of getting 1 at least twice when rolling a fair die 12 times
body: <pre><code>import random
  import sys
  
  bestcounter1 = 0
  bestcounter2=0
  get_sample = int(sys.argv[1])
  
  for i in range(get_sample):
      for i in range(12):
          if (random.randint(1,6)==1):
              bestcounter1+=1
              bestcounter2+=1
  
  oneatleasttwice = (bestcounter2*1.0)/(2*(get_sample))
  
  #Divide by 2 to make both comparable. Otherwise 2 will always be greater than 1 !
  print("One atleast twice in 12 rolls: ", oneatleasttwice)
  </code></pre>
  
  <p>Can anybody explain whether the logic used here is correct or not? The output I get is always around 1.</p>
  
  <p>Thanks</p>