Slaunger wrote:
Hi Gerard,
This definitely looks like a path to walk along, and I think your code
does the trick, although I have to play a little around with the
groupby method, of which I had no prior knowledge. I think I will
write some unit test cases to stress test you concept (on Monday, wh
Anton Vredegoor wrote:
On Fri, 21 Nov 2008 18:10:02 +0100
Gerard flanagan <[EMAIL PROTECTED]> wrote:
data = '''
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3
So I think you just need to find the first two complete sequences of
1,6,10 and 0,3,9, remove any repetitions and then you're done.
data = '''
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 7 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3
On 21 Nov., 18:10, Gerard flanagan <[EMAIL PROTECTED]> wrote:
> Slaunger wrote:
> > Hi all,
>
> > I am a Python novice, and I have run into a problem in a project I am
> > working on, which boils down to identifying the patterns in a sequence
> > of integers, for example
>
> > 1 6 6 1 6 6 1 6
On 21 Nov., 23:36, Mensanator <[EMAIL PROTECTED]> wrote:
> Your rules appear to be incomplete and inconsistent.
OK. Let me try to clarify then...
> > 3. Pattern A only consists of the numbers 0, 3, and 9. 3, 3 is always
> > followed by 0
>
> But does a 3 always follow a 3? Can you have 3, 0, 3, 0?
>
> > I am pretty sure I can figure out how to do that, but I would like to
> > have some guidance on the most pythonic approach to this.
>
> Then it would be a good starting point to write some code. Then you
> could post it and ask how it can be made more 'pythonic'.
>
That is actually a good poi
On Fri, 21 Nov 2008 18:10:02 +0100
Gerard flanagan <[EMAIL PROTECTED]> wrote:
> data = '''
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 1
On Nov 21, 9:13 am, Slaunger <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am a Python novice, and I have run into a problem in a project I am
> working on, which boils down to identifying the patterns in a sequence
> of integers, for example
>
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3
Slaunger <[EMAIL PROTECTED]> writes:
> I am a Python novice, and I have run into a problem in a project I am
> working on, which boils down to identifying the patterns in a sequence
> of integers, for example
>
> 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
> 1 6 6 1 6 6 1
Haven't followed the entire thread, so I could be making a silly,
out-of-place remark, and apologies in advance for the same.However, to me it
looks like Slaunger wants to find 2 of the longest repeating patterns, and
not just 2 specific patterns (though from the introductory test, it appears
to be
Slaunger wrote:
Hi all,
I am a Python novice, and I have run into a problem in a project I am
working on, which boils down to identifying the patterns in a sequence
of integers, for example
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6
Hi all,
I am a Python novice, and I have run into a problem in a project I am
working on, which boils down to identifying the patterns in a sequence
of integers, for example
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6
1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3
12 matches
Mail list logo