title: Pythonic way of percentagechance
body: <p>I'm currently trying to create a method for having a random chance of an item (represented within a game) such as 20% for one item, or 50% percentage or even 1%. I have tried doing this with the code depicted below: </p>
  
  <pre><code>from random import randint
  
  def Break():
      print(".")
  
  def Treasure():
  
      Gen = randint(1,100)
      if Gen &lt;= 10:
          print("10%")
          Break()
  
      Gen = randint(1,100)
      if Gen &lt;= 10:
          print("10%")
          Break()
  
      Gen = randint(1,100)
      if Gen &lt;= 10:
          print("10%")
          Break()
  
      Gen = randint(1,100)
      if Gen &lt;= 10:
          print("10%")
          Break()
  
      Gen = randint(1,100)
      if Gen &lt;= 10:
          print("10%")
          Break()
  </code></pre>
  
  <p>This code method kind of works, the problem is that even if a percentage from here is chosen and Break() is called, there is still the possibility of it having more than one percentage listed 
  So if It said 80% then Break()
  It could also list 50% then Break() a secound time.</p>
  
  <p><strong>So my question is, how could I do the following:</strong></p>
  
  <ul>
  <li>More efficent code</li>
  <li>Make the percentages only call ONE then Break()</li>
  <li>Sure way of making the percentages what they say, eg 50% half chance.</li>
  </ul>
  
  <p>Testing Code: (Edited)</p>
  
  <pre><code>if gen &lt;= 10:
      print("10%")
  elif gen &lt;= 20:
      print("20%")
  elif gen &lt;= 30:
      print("30%")
  elif gen &lt;= 40:
      print("30%")
  elif gen &lt;= 50:
      print("50%")
  elif gen &lt;= 60:
      print("60%")
  elif gen &lt;= 70:
      print("70%")
  elif gen &lt;= 80:
      print("80%")
  elif gen &lt;= 90:
      print("90%")
  </code></pre>
  
  <p>Should this not make 90% the most likely, and in turn 10% the least?</p>