
-----------------------------------
BigBear
Mon Mar 30, 2009 8:16 pm

[Python] Help with dividing with lists
-----------------------------------
totalweeds = 0
names = 

For some reason I can display them individually and they have a value but I can't seem to divide them and get a value.

-----------------------------------
Alexmula
Mon Mar 30, 2009 8:38 pm

RE:[Python] Help with dividing with lists
-----------------------------------
when you divide by integers it rounds the numbers .. so for example 3/9 would be 0 and 7/3 would be 2. but 3.00/9.00 is 0.33333.

-----------------------------------
Tony
Mon Mar 30, 2009 9:19 pm

RE:[Python] Help with dividing with lists
-----------------------------------
I think 3.0/9 is sufficient.

-----------------------------------
McKenzie
Wed Apr 01, 2009 9:05 pm

Re: [Python] Help with dividing with lists
-----------------------------------
In this case you can't just add .0 to the end of your code. You need to use float. For example if I have two integers x and y use float(x)/y. The other option is, at the top of your program use:
[code]from __future__ import division[/code]
This will cause int/int -> float.

-----------------------------------
BigBear
Thu Apr 02, 2009 2:09 pm

RE:[Python] Help with dividing with lists
-----------------------------------
That makes sence!

I guess right now I see it as pointless and more work to make sure things are ints or floats but it will more usefull later
