title: Setting the length of a float or number
body: <p>I've been looking around to try and set the length of floats or decimals to 2 places, I'm doing this for a set of course work, I have tried <code>getcontext</code> but it does nothing.</p>
  
  <pre><code>from decimal import *
  getcontext().prec = 2
  price = ("22.5")
  #I would like this to be 22.50, but as it comes form a list and I use float a bit, so I have to convert it to decimal (?)
  price = Decimal(price)
  print (price)
  </code></pre>
  
  <p>But the output is:</p>
  
  <pre><code>22.5
  </code></pre>
  
  <p>If anyone knows a better way to set the length of a decimal to 2 decimal places (using it in money) or where I'm going wrong, it would be helpful.</p>