Python Pycharm loop error
<p>I started at university and programming in python 3.5 is one of our important courses. We use an online website to code and compile the programs but I like to save them on my computer as well but there is a slight error...</p>

<pre><code>tolerantie = float(input("Tolerantie = "))

i = 0
fact = 1
nterm = float(1)
s = 0

while nterm &gt; tolerantie:
    s += nterm
    i += 1
    fact *= i
    nterm = 1/fact

print s
print i
</code></pre>

<p>I use this program to approximate the number 'e' using Pycharm but my computer always gives the values s=2 and i=2 so I assume it doesn't execute the while-loop... Do I need to add something because it is in Pycharm because this program works perfectly on the server of the University?</p>

<p>Regards,</p>

<p>In your case <code>PyCharm</code> uses <code>python2.x</code> to compile the script.<br>
You can <a href="http://stackoverflow.com/questions/1267869/how-can-i-force-division-to-be-floating-point-in-python">force division to be floating point in  <code>Pythno2.x</code></a> or change pycharm configuration and choose <code>Python3.5</code> interpreter then instead of <code>print s</code> use <code>print(s)</code>.</p>

python while-loop pycharm