Ok /prog/, so I've been awfully busy learning python lately and I was wondering if you could help me.I've been working on my side project lately and I came across this interesting little math problem and was hoping that some skilled /prog/grammers could help me out with an elegant solution.
People can rate cheeseburgers on my website with a star rating of 0-5 stars in whole stars. Five would be mighty tasty and zero would be disgusting. I want to show the average of everyone’s ratings of a single cheeseburger to the closest half star. I have already calculated the average rating as a float (star_sum) and the total number of people that rated the particular cheeseburger (num_raters). The result would then be stored as a float in a variable named “stars.”
here is my python code:
# 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))
I knew there was a way to do this mathematically, I just couldn’t remember how. I suppose the same trick would work for rounding to thirds, fourths, etc. Thanks so much to r, Christopher Finke, and Bob for the better approach.
I knew there was a way to do this mathematically, I just couldn’t remember how. I suppose the same trick would work for rounding to thirds, fourths, etc. Thanks so much to r, Christopher Finke, and Bob for the better approach.
>>16
Because we're all jailhouse gay due to the lack of contact with real women and we idolize traps like Bridget and due to homophobic bullying being a nerd is pretty much the same as being gay or wishing to be the little girl.
Hey, it's not like we're allowed to use our penises. Might as well get it cut off. It's not like it's doing us any good.
Name:
Anonymous2008-12-04 20:36
>>15
What the fuck man... I wouldn't wish this pain on any other person.
then you can experience the pleasure of being cummed inside
Name:
Anonymous2008-12-05 1:38
A family walks into a talent agency. It's a father, mother, son, daughter and dog. The father says to the talent agent, "We have a really amazing act. You should represent us."
The agent says, "Sorry, I don't represent family acts. They're a little too cute."
The mother says, "Sir, if you just see our act, we know you would want to represent us."
The agent says, "OK. OK. I'll take a look."
The Father then raises his hands and exclaims: "Wait until you see this, it's a family act, a song and a dance, an animal act, audience participation... it's got everything! First off my wife and I come out on the stage, I'm wearing a tux, she's in a full gown. I take off the tux and lift up her gown... I then begin fucking her in the ass like no tomorrow while she sings the national anthem. Then my son comes out drops his pants shoves his cock in his mother's mouth, and she keeps singing... although now it's more of a hum. While this is happening my daughter comes out stark naked with a beach ball. she balances it on her nose and starts clapping her hands together, see this is where the animal part comes in because my daughter is retarded, she barks like a seal. After i blow my load in my wife's asshole, I jam my fist up there and do a ventriloquist routine all the while my son is still face fucking my wife while she goes into "Oh, Canada". Now my retard daughter brings a trunk up on stage and throws on a burkha. I then pull my fist out of my wife's ass, give it a good lick, go out into the audience and find the biggest pile driving black guy i can find. I have him come up on stage and put on a pig mask and drape himself in the american flag and proceed to anally violate my retarded pre-teen daughter. I then down a bottle of laxative, shit on stage rub the shit all over my face, and sing amazing grace in the best slave voice i have. My wife bites my son's cock off and draws a swastika in blood on her bare chest, then puts on a kkk hood and strap on and fucks me while i sing my favorite negro spirituals. After the black guy blows his load all over my retarded daughter and proceeds to fuck my adolescent son's decimated body, cause you know brothers, they can never get enough ass... my dog comes out..."
The talent agent then goes "Well what on Earth does the dog do?"
the man licks his lips and says "Well the dog comes out wearing a little pink tutu, honks a few horns, and jumps through a hoop."
For the longest time, the agent just sits in silence. Finally, he manages, "That's a hell of an act. What do you call it?"
Gown I then begin fucking her in some way but start by watching the SICP video lectures and then click the mouse and keyboard consumes quite a bit and I found this works in sbcl asdf defsystem.