title: Python Chest Opening Odds
body: <p>I've been trying to figure out how to recreate odds in python for a chest opening game thingy, but the <code>random.choice</code> isn't really considering different odds. The goal I'm trying to achieve is set certain odds for different &quot;rarities&quot;, like for example having 50% probability for getting an &quot;Uncommon&quot;.</p>
  <p>Code example:</p>
  <pre><code>import random
  
  skins = {
      'Common':'Knife',
      'Uncommon':'Pistol',
      'Rare':'Submachine Gun',
      'Epic':'Automatic Rifle',
      'Legendary':'Semi-Automatic Sniper Rifle'
  }
  
  
  print(&quot;Welcome to N/A&quot;)
  print(&quot;Input 'open' to open a chest.&quot;)
  n = input(&quot;&gt; &quot;)
  if n == &quot;open&quot;:
      print(random.choice(skins))
  </code></pre>