frank at chagford.com
Sat Feb 15 11:04:17 CET 2014
"Luke Geelen" <luke.geelen at gmail.com> wrote in message
news:ec88852e-1384-4aa5-834b-85135be94ab9 at googlegroups.com...
> Op zaterdag 15 februari 2014 10:18:36 UTC+1 schreef Luke Geelen:
> i have been working on a python resistor calculator to let my class show
> what you can do with python.
> now i have a script that makes the more speekable value of the resistance
> i commented it because it doesn't work (yet), when i have a resistance of
> 9.9 Giga ohms it says it is 9 giga ohms. it seems to work with natural
> number, anyway of using decimals insted so that it says : the resistance
> is 9.9 Giga Ohms instead of 9 ?
You don't say which version of python you are using.
If you are using python2, an integer divided by an integer always returns an
It was changed in python3 to return a float -
You can reproduce the python3 behaviour in python2 by adding a 'future'
>>> from __future__ import division
More information about the Python-list