On Wed, 2011-12-28 at 06:44 +0530, Kenneth Gonsalves wrote:
> def peoria(holes):
> import random
> random.shuffle(holes)
> result = []
> checklist = []
> used = []
> for hole in holes:
> if len(checklist) == 3:
> break
> if hole[1] not in checkli
On Mon, 2011-12-26 at 17:34 +0530, Pratap Chakravarthy wrote:
> > I don't like special casing stuff and the 3 selections outside the>
> "main" flow sticks out in my solution.
> I guess that is right. Any logic that is outside the main flow breaks
> the beauty
> and create kludge.
the old fashione
On Tue, 2011-12-27 at 18:19 +0530, Pratap Chakravarthy wrote:
> I have posted at, http://pastebin.com/BG6X70Sv
> I don't understand why or how it got stripped.
mailing list policy
--
regards
Kenneth Gonsalves
___
BangPypers mailing list
BangPypers@pyt
I have posted at, http://pastebin.com/BG6X70Sv
I don't understand why or how it got stripped.
Cheers,
On Tue, Dec 27, 2011 at 11:26 AM, Kenneth Gonsalves wrote:
> On Mon, 2011-12-26 at 17:34 +0530, Pratap Chakravarthy wrote:
>> Attached is the file.
>
> I think the attachment got stripped.
> --
On Mon, 2011-12-26 at 17:34 +0530, Pratap Chakravarthy wrote:
> Attached is the file.
I think the attachment got stripped.
--
regards
Kenneth Gonsalves
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpyper
> I don't like special casing stuff and the 3 selections outside the> "main"
> flow sticks out in my solution.
I guess that is right. Any logic that is outside the main flow breaks
the beauty
and create kludge.
Attempted to solve the same problem using Erlang, and surprisingly what was
looking li
Kenneth Gonsalves writes:
[...]
> just curious - why do you and Noufal think this is a crude method?
I don't like special casing stuff and the 3 selections outside the
"main" flow sticks out in my solution.
--
~noufal
http://nibrahim.net.in
Parting is such sweet sorrow. -William Shakespear
On Mon, 2011-12-26 at 10:01 +0530, Pratap Chakravarthy wrote:
> # Initialize variables
> holes, bk = HOLES[:], {} ;
> random.shuffle( holes )
>
> # Make buckets
> [ bk.setdefault(y, []).append((x,y)) for x, y in holes ]
>
> # Result
> print [ bk[3].pop(0), bk[4].pop(0), bk[5].pop(0) ] + random.
From: steve
> I am sorry, I didn't quite understand this bit "it is necessary to generate a
> random list of 6 holes.", since the list below has 18 elements.
That means out of the 18 elements from the list, we need 6 random
elements but with one constraint.
> In any case, whether you need 6 or
On Mon, 2011-12-26 at 10:01 +0530, Pratap Chakravarthy wrote:
> # Initialize variables
> holes, bk = HOLES[:], {} ;
> random.shuffle( holes )
>
> # Make buckets
> [ bk.setdefault(y, []).append((x,y)) for x, y in holes ]
>
> # Result
> print [ bk[3].pop(0), bk[4].pop(0), bk[5].pop(0) ] + random.
On Mon, 2011-12-26 at 10:01 +0530, Pratap Chakravarthy wrote:
> # Initialize variables
> holes, bk = HOLES[:], {} ;
> random.shuffle( holes )
>
> # Make buckets
> [ bk.setdefault(y, []).append((x,y)) for x, y in holes ]
>
> # Result
> print [ bk[3].pop(0), bk[4].pop(0), bk[5].pop(0) ] + random.
# Initialize variables
holes, bk = HOLES[:], {} ;
random.shuffle( holes )
# Make buckets
[ bk.setdefault(y, []).append((x,y)) for x, y in holes ]
# Result
print [ bk[3].pop(0), bk[4].pop(0), bk[5].pop(0) ] + random.sample(
bk[3] + bk[4] + bk[5], 3 )
Some times the crude method is the best meth
Hi,
On 12/25/2011 12:52 PM, Kenneth Gonsalves wrote:
> hi,
>
> a golf course has 18 holes. There are three types of hole - par 3, par 4
> and par 5. For a certain type of tournament it is necessary to generate
> a random list of 6 holes. The only condition is that this list should
> contain at le
> a golf course has 18 holes. There are three types of hole - par 3, par 4
> and par 5. For a certain type of tournament it is necessary to generate
> a random list of 6 holes. The only condition is that this list should
> contain at least one of each type of hole. What would be an elegant way
> of
Kenneth Gonsalves writes:
> hi,
>
> a golf course has 18 holes. There are three types of hole - par 3, par 4
> and par 5. For a certain type of tournament it is necessary to generate
> a random list of 6 holes. The only condition is that this list should
> contain at least one of each type of hol
On Sun, Dec 25, 2011 at 12:52 PM, Kenneth Gonsalves wrote:
> hi,
>
> a golf course has 18 holes. There are three types of hole - par 3, par 4
> and par 5. For a certain type of tournament it is necessary to generate
> a random list of 6 holes. The only condition is that this list should
> contain
hi,
a golf course has 18 holes. There are three types of hole - par 3, par 4
and par 5. For a certain type of tournament it is necessary to generate
a random list of 6 holes. The only condition is that this list should
contain at least one of each type of hole. What would be an elegant way
of doin
17 matches
Mail list logo