> Im using 2.6 python and when running this >
> class progess(): > > def __init__(self, number, total, char): > > percentage = float(number/total*100) > percentage = int(round(percentage)) > char = char * percentage > print char > > progess(100, 999, "*") > > the "percentage = float(number/total*100)" always equals 0.0 Try percentage = float(number)/total*100 # The closing bracket position is the important one The problem is that you're converting to float after the int division damage has been done. Cheers, Drea
-- http://mail.python.org/mailman/listinfo/python-list