On Wed, Jun 4, 2008 at 11:03 AM, BEES INC <bees.inc@gmail .comwrote:
def roundstars(inva lue):
inv *= 2
inv += .5
return float(int(inv))/2
seems to work for me.
I've never had the pleasure, but I've heard they're a wonderful experience.
-Chuckk
--
My Solution (in Python):
>
# round to one decimal place and
# separate into whole and fractional parts
parts = str(round(star_ sum/num_raters, 1)).split('.')
whole = int(parts[0])
frac = int(parts[1])
if frac < 3:
___frac = 0
elif frac 7:
___frac = 0
___whole += 1
else:
___frac = 5
# recombine for a star rating rounded to the half
stars = float(str(whole )+'.'+str(frac) )
>
# round to one decimal place and
# separate into whole and fractional parts
parts = str(round(star_ sum/num_raters, 1)).split('.')
whole = int(parts[0])
frac = int(parts[1])
if frac < 3:
___frac = 0
elif frac 7:
___frac = 0
___whole += 1
else:
___frac = 5
# recombine for a star rating rounded to the half
stars = float(str(whole )+'.'+str(frac) )
inv *= 2
inv += .5
return float(int(inv))/2
seems to work for me.
Mmmm… In-N-Out Burgers… Please reply if you've got a better solution.
-Chuckk
--