don't forget to use dot or converge into float.

perc = 42./250
or
perc = float(42)/250

otherwise:
it is treated as integer.

pujo

On 07 Nov 2005 11:50:05 -0200, Jorge Godoy <[EMAIL PROTECTED]> wrote:
Johan Geldenhuys <[EMAIL PROTECTED]> 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

If you want it to "read" as percentage:

perc_100 = (42/250)*100


Sds,
--
Jorge Godoy      <[EMAIL PROTECTED]>

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to