On Jun 6, 2:25 am, Rüdiger Werner [EMAIL PROTECTED] wrote:
BEES INC [EMAIL PROTECTED] schrieb im Newsbeitragnews:[EMAIL PROTECTED]
...
Problem: Star Ratings
People can rate cheeseburgers on my website with a star rating of 0-5
stars (whole stars only), 5 being mighty tasty and 0 being
I've been awfully busy programming lately. My Django-based side
project is coming along well and I hope to have it ready for use in a
few weeks. Please don't ask more about it, that's really all I can say
for now. Anyways, I came across an interesting little math problem
today and was hoping some
BEES INC wrote:
I've been awfully busy programming lately. My Django-based side
project is coming along well and I hope to have it ready for use in a
few weeks. Please don't ask more about it, that's really all I can say
for now. Anyways, I came across an interesting little math problem
today
On Jun 4, 9:03 am, BEES INC [EMAIL PROTECTED] wrote:
I've been awfully busy programming lately. My Django-based side
project is coming along well and I hope to have it ready for use in a
few weeks. Please don't ask more about it, that's really all I can say
for now. Anyways, I came across an
On Thu, Jun 5, 2008 at 11:52 AM, Chuckk Hubbard
[EMAIL PROTECTED] wrote:
On Wed, Jun 4, 2008 at 11:03 AM, BEES INC [EMAIL PROTECTED] wrote:
My Solution (in Python):
# round to one decimal place and
# separate into whole and fractional parts
parts = str(round(star_sum/num_raters,
BEES INC wrote:
I've been awfully busy programming lately. My Django-based side
project is coming along well and I hope to have it ready for use in a
few weeks. Please don't ask more about it, that's really all I can say
for now. Anyways, I came across an interesting little math problem
today
On Wed, Jun 4, 2008 at 11:03 AM, BEES INC [EMAIL PROTECTED] wrote:
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
On Jun 4, 9:03 am, BEES INC [EMAIL PROTECTED] wrote:
I've been awfully busy programming lately. My Django-based side
project is coming along well and I hope to have it ready for use in a
few weeks. Please don't ask more about it, that's really all I can say
for now. Anyways, I came across an
BEES INC [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
...
Problem: Star Ratings
People can rate cheeseburgers on my website with a star rating of 0-5
stars (whole stars only), 5 being mighty tasty and 0 being disgusting.
I would like to show the average of everyone's ratings
On Mar 19, 2:17 pm, BJörn Lindqvist [EMAIL PROTECTED] wrote:
On Mon, Mar 17, 2008 at 11:57 PM, Arnaud Delobelle
[EMAIL PROTECTED] wrote:
def make_slope(distance, parts):
step = distance / float(parts)
intstep = int(step)
floatstep = step - intstep
steps =
On Apr 13, 5:35 pm, Ivan Illarionov [EMAIL PROTECTED] wrote:
On Mar 19, 2:17 pm, BJörn Lindqvist [EMAIL PROTECTED] wrote:
On Mon, Mar 17, 2008 at 11:57 PM, Arnaud Delobelle
[EMAIL PROTECTED] wrote:
def make_slope(distance, parts):
step = distance / float(parts)
On Mon, Mar 17, 2008 at 11:57 PM, Arnaud Delobelle
[EMAIL PROTECTED] wrote:
def make_slope(distance, parts):
step = distance / float(parts)
intstep = int(step)
floatstep = step - intstep
steps = []
acc = 0.0
for i in range(parts):
acc +=
On 18 Mar, 00:58, Jeff Schwab [EMAIL PROTECTED] wrote:
def make_slope(distance, parts):
if parts == 0:
return []
q, r = divmod(distance, parts)
if r and parts % r:
q += 1
return [q] + make_slope(distance - q, parts - 1)
Beautiful. If Python could
sturlamolden [EMAIL PROTECTED] wrote:
On 18 Mar, 00:58, Jeff Schwab [EMAIL PROTECTED] wrote:
def make_slope(distance, parts):
if parts == 0:
return []
q, r = divmod(distance, parts)
if r and parts % r:
q += 1
return [q] + make_slope(distance - q,
Marc Christiansen wrote:
sturlamolden [EMAIL PROTECTED] wrote:
On 18 Mar, 00:58, Jeff Schwab [EMAIL PROTECTED] wrote:
def make_slope(distance, parts):
if parts == 0:
return []
q, r = divmod(distance, parts)
if r and parts % r:
q += 1
return [q] +
Jeff Schwab [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
| Marc Christiansen wrote:
| This was my first thought, too. But tailcall optimisation wouldn't help
| here. `make_slope` is not tail recursive, the `+` (aka list.extend)
gets
| executed after the recursion.
|
|
| def
Here is an interesting math problem:
You have a number X 0 and another number Y 0. The goal is to
divide X into a list with length Y. Each item in the list is an
integer. The sum of all integers is X. Each integer is either A or A +
1, those should be evenly distributed.
Example:
17 // 5 = 3
On Mar 17, 5:24 pm, BJörn Lindqvist [EMAIL PROTECTED] wrote:
Here is an interesting math problem:
You have a number X 0 and another number Y 0. The goal is to
divide X into a list with length Y. Each item in the list is an
integer. The sum of all integers is X. Each integer is either
On Mar 17, 10:24 pm, BJörn Lindqvist [EMAIL PROTECTED] wrote:
Here is an interesting math problem:
You have a number X 0 and another number Y 0. The goal is to
divide X into a list with length Y. Each item in the list is an
integer. The sum of all integers is X. Each integer is either
On Mar 18, 1:24 am, BJörn Lindqvist [EMAIL PROTECTED] wrote:
Here is an interesting math problem:
You have a number X 0 and another number Y 0. The goal is to
divide X into a list with length Y. Each item in the list is an
integer. The sum of all integers is X. Each integer is either
BJörn Lindqvist wrote:
Here is an interesting math problem:
You have a number X 0 and another number Y 0. The goal is to
divide X into a list with length Y. Each item in the list is an
integer. The sum of all integers is X. Each integer is either A or A +
1, those should be evenly
Arnaud Delobelle wrote:
On Mar 17, 10:24 pm, BJörn Lindqvist [EMAIL PROTECTED] wrote:
Here is an interesting math problem:
You have a number X 0 and another number Y 0. The goal is to
divide X into a list with length Y. Each item in the list is an
integer. The sum of all integers is X
22 matches
Mail list logo