On Fri, 2009-05-22 at 09:59 -0400, Dave Angel wrote: > > Tim Wintle wrote: > > On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote:
> >> Change "float(number/total*100)" to "float(number)/total*100" and it > >> should work: > >> > > > > I'd use: > > > > (number * 100.)/total > > > > - works because > > <int> * <float> => <float> > It's the old-timer in me, but I'd avoid the float entirely. You start > with ints, and you want to end with ints. So simply do the multiply > first, then the divide. > > number * 100/total Agreed, to be honest I'd not fully read the original post and didn't realise everything was an int. > > will get the same answer. > -- http://mail.python.org/mailman/listinfo/python-list