[Tutor] Percentage

Steve Nelson sanelson at gmail.com
Mon Nov 7 15:04:06 CET 2005


On 07 Nov 2005 11:50:05 -0200, Jorge Godoy <godoy at ieee.org> wrote:
> Johan Geldenhuys <johan at accesstel.co.za> writes:
>
> > What is the syntax if I want to work out what percentage 42 is out of 250?
>
> If you want it as a factor to multiply / divide by something:
>
> perc = 42/250

Don't you need to specify one of these numbers as a float?

>>> print 42/250
0
>>> print 42/250.0
0.168

I recall reading somewhere that all division would be 'true division'
from >3.0 but this isn't the case in 2.x is it?

> Jorge Godoy      <godoy at ieee.org>

S.


More information about the Tutor mailing list