How to limit number of digits after decimal point in python random
<p>I am using this code:<code>newAgent = [random.gauss(0, 1), random.gauss(0, 1)]</code>
and I want to limit the number of digits after decimal point.now is about 20 digits.</p>

<p>The answer is quite simple. Just use <code>round</code> and then specify the places with <code>, #Number of spaces</code>. In this example, I did to 5 decimal spaces.</p>

<pre><code>import random
newAgent = [random.gauss(0, 1), random.gauss(0, 1)]
print(round(newAgent[0], 5), round(newAgent[1], 5))
</code></pre>

python