title: Prints words based on their probabilities
body: <p><strong>PROBLEM STATEMENT:</strong></p>
  <p>Write a program that prints &quot;I love&quot; followed by one word: the additional word should be 'dogs' with 80% probability, 'cats' with 10% probability, and 'bats' with 10% probability.Here's an example output:</p>
  <pre><code>I love bats
  </code></pre>
  <br>
  <p><strong>EXAMPLE</strong></p>
  <p>The following program prints out the word 'dog' with 20% probability  (Python code)</p>
  <pre><code>import random
  prob = 0.20
  
  if random.random() &lt; prob:
      print('dog')
              
  </code></pre>
  <p>Why does it print 'dog' with 20% probability? The idea is to draw a random value between 0.00 and 1.01 – that's what the function random() in module random does – and to check whether it is less than the required probability value expressed as a decimal number. For example, the probability that the random value falls between 0.00 and 0.50 is 50%. The probability that the value falls between 0.50 and 1.0 is also 50%. The probability that it falls between 0.00 and 0.20 is 20%, and so forth.
  Original exercise on <a href="https://buildingai.elementsofai.com/Getting-started-with-AI/hill-climbing" rel="nofollow noreferrer">Elements of AI: Building AI, chapter 1</a></p>
  <br/>
  <p><strong>WHAT I CAN'T UNDERSTAND:</strong></p>
  <p>I need to print one only word: bats, cats or dogs. How can I print one when both cats and bats have exactly same 10% probability. An <strong>if</strong> condition can not differentiate between 0.10 and 0.10.</p>