Re: simple python math help.

2008-06-15 Thread Jarred Bishop
Thanks James. I typed the above post before I saw your response. disregard it. On Jun 15, 10:02 pm, Jarred Bishop <[EMAIL PROTECTED]> wrote: > Thanks for that, i see now. However it doesn't solve my problem. Is > there a way to force it to return a decimal when whole numbers are > supplied? > >

Re: simple python math help.

2008-06-15 Thread Gene Campbell
your doing integer division, and / gets you the number of times 200 is divisible by 400, which is 0 times in a integer context. try 200.0/400 if you make one a float, you get a float answer. or this... >>> size = float(200), float(400) >>> size[0]/size[1] 0.5 I'm still quite a python/django

Re: simple python math help.

2008-06-15 Thread Jarred Bishop
Thanks for that, i see now. However it doesn't solve my problem. Is there a way to force it to return a decimal when whole numbers are supplied? I'm using the python image library (http://www.pythonware.com/library/ pil/handbook/image.htm) to resize some images, and the size of those images is

Re: simple python math help.

2008-06-15 Thread James Bennett
On Sun, Jun 15, 2008 at 4:36 AM, Jarred Bishop <[EMAIL PROTECTED]> wrote: > it returns '0'. which isnt much help. how do i get '0.5' or '.5' ? This has a very long history, going all the way back to the C programming language (which the Python interpreter is written in, and which many

Re: simple python math help.

2008-06-15 Thread Sebastian Bauer
size = [200.0, 400.0] return size[0]/size[1] Jarred Bishop pisze: > Hi, this is driving me crazy. I'm sure there is a VERY simple solution > but can't seem to find it. thanks for you help. > > if I have > > size = 200, 400 > return size[0]/size[1] > > it returns '0'. which isnt much

simple python math help.

2008-06-15 Thread Jarred Bishop
Hi, this is driving me crazy. I'm sure there is a VERY simple solution but can't seem to find it. thanks for you help. if I have size = 200, 400 return size[0]/size[1] it returns '0'. which isnt much help. how do i get '0.5' or '.5' ? Thanks.