Re: Wrapping around a list in Python.

2013-12-16 Thread Dave Angel
On Sun, 15 Dec 2013 21:26:49 -0800 (PST), shengjie.sheng...@live.com wrote: The idea is to grab the last 4 elements of the array. However i have an array that contains a few hundred elements in it. And the values continues to .append over time. How would i be able to display the last 4 elements

Re: Wrapping around a list in Python.

2013-12-16 Thread David Robinow
On Mon, Dec 16, 2013 at 12:26 AM, wrote: > The idea is to grab the last 4 elements of the array. However i have an array > that contains a few hundred elements in it. And the values continues to > .append over time. How would i be able to display the last 4 elements of the > array under such a

Re: Wrapping around a list in Python.

2013-12-16 Thread Denis McMahon
On Mon, 16 Dec 2013 15:59:32 +1100, Ben Finney wrote: > shengjie.sheng...@live.com writes: > >> Hi guys, I am trying to create a fixed list which would allow my values >> to be wrapped around it. > > This doesn't make a lot of sense to me, but I assume you have a purpose > in mind for this. What

Re: Wrapping around a list in Python.

2013-12-16 Thread Mark Lawrence
On 16/12/2013 05:10, shengjie.sheng...@live.com wrote: On Monday, 16 December 2013 13:07:46 UTC+8, shengjie...@live.com wrote: Would you please read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing, thanks. -- My fellow Pythonistas, a

Re: Wrapping around a list in Python.

2013-12-16 Thread Peter Otten
shengjie.sheng...@live.com wrote: > The idea is to grab the last 4 elements of the array. However i have an > array that contains a few hundred elements in it. And the values continues > to .append over time. How would i be able to display the last 4 elements > of the array under such a condition?

Re: Wrapping around a list in Python.

2013-12-15 Thread shengjie . shengjie
On Monday, 16 December 2013 12:38:14 UTC+8, shengjie...@live.com wrote: > Hi guys, I am trying to create a fixed list which would allow my values to be > wrapped around it. > > For example i have 10 values : 0,1,2,3,4,5,6,7,8,9 > > I need to create a list which contains 4 numbers and when the n

Re: Wrapping around a list in Python.

2013-12-15 Thread shengjie . shengjie
On Monday, 16 December 2013 13:10:22 UTC+8, Gary Herron wrote: > On 12/15/2013 08:38 PM, shengjie.sheng...@live.com wrote: > > > Hi guys, I am trying to create a fixed list which would allow my values to > > be wrapped around it. > > > For example i have 10 values : 0,1,2,3,4,5,6,7,8,9 > > > I

Re: Wrapping around a list in Python.

2013-12-15 Thread Gary Herron
On 12/15/2013 08:38 PM, shengjie.sheng...@live.com wrote: Hi guys, I am trying to create a fixed list which would allow my values to be wrapped around it. For example i have 10 values : 0,1,2,3,4,5,6,7,8,9 I need to create a list which contains 4 numbers and when the number exceeds the list, it

Re: Wrapping around a list in Python.

2013-12-15 Thread shengjie . shengjie
On Monday, 16 December 2013 13:07:46 UTC+8, shengjie...@live.com wrote: > On Monday, 16 December 2013 12:59:32 UTC+8, Ben Finney wrote: > > > shengjie.sheng...@live.com writes: > > > > > > > > > > > > > Hi guys, I am trying to create a fixed list which would allow my > > > > > > > valu

Re: Wrapping around a list in Python.

2013-12-15 Thread shengjie . shengjie
On Monday, 16 December 2013 12:59:32 UTC+8, Ben Finney wrote: > shengjie.sheng...@live.com writes: > > > > > Hi guys, I am trying to create a fixed list which would allow my > > > values to be wrapped around it. > > > > This doesn't make a lot of sense to me, but I assume you have a purpose

Re: Wrapping around a list in Python.

2013-12-15 Thread Ben Finney
shengjie.sheng...@live.com writes: > Hi guys, I am trying to create a fixed list which would allow my > values to be wrapped around it. This doesn't make a lot of sense to me, but I assume you have a purpose in mind for this. What is the purpose? Perhaps it will help the explanation if we know wh

Fwd: Re: Wrapping around a list

2013-11-28 Thread Ricardo Aráoz
El 27/11/13 07:46, amjad...@gmail.com escribió: Hello, I am working on a problem (Bioinformatics domain) where all possible combinations of input string needs to be printed as sublist For example: Input string : "LEQN" Output= "[L","E","Q","N"]["LE","EQ","QN","NL"] ["LEQ","EQN","QNE","NLE"] ["

Re: Wrapping around a list

2013-11-27 Thread Amjad Syed
On Wednesday, November 27, 2013 2:14:18 PM UTC+3, Chris Angelico wrote: > On Wed, Nov 27, 2013 at 10:07 PM, Amjad Syed wrote: > > > Thanks Chris for the reply. But i would like sliding function to be > > scalable, as input string can be of 100 letters. > > > > A hundred isn't much to work wit

Re: Wrapping around a list

2013-11-27 Thread Peter Pearson
On Wed, 27 Nov 2013 08:33:43 -0500, Neil Cerutti wrote: > On Wed, Nov 27, 2013 at 5:46 AM, wrote: >> I am working on a problem (Bioinformatics domain) where all >> possible combinations of input string needs to be printed as >> sublist >> >> For example: >> Input string : "LEQN" >> Output= "[L",

Re: Wrapping around a list

2013-11-27 Thread rusi
On Wednesday, November 27, 2013 4:16:50 PM UTC+5:30, Amjad Syed wrote: > Hello, > > I am working on a problem (Bioinformatics domain) where all possible > combinations of input string needs to be printed as sublist If we take the standard combinations (Pascal triangle) result nCr + nCr-1 = n+1Cr

Re: Wrapping around a list

2013-11-27 Thread Neil Cerutti
On Wed, Nov 27, 2013 at 5:46 AM, wrote: > I am working on a problem (Bioinformatics domain) where all > possible combinations of input string needs to be printed as > sublist > > For example: > Input string : "LEQN" > Output= "[L","E","Q","N"] > ["LE","EQ","QN","NL"]["LEQ","EQN","QNE","NLE"]["LEQ

Re: Wrapping around a list

2013-11-27 Thread Ned Batchelder
On 11/27/13 6:14 AM, Chris Angelico wrote: On Wed, Nov 27, 2013 at 10:07 PM, Amjad Syed wrote: Thanks Chris for the reply. But i would like sliding function to be scalable, as input string can be of 100 letters. A hundred isn't much to work with, and your code will be fairly simple. Give it

Re: Wrapping around a list

2013-11-27 Thread Chris Angelico
On Wed, Nov 27, 2013 at 10:07 PM, Amjad Syed wrote: > Thanks Chris for the reply. But i would like sliding function to be scalable, > as input string can be of 100 letters. A hundred isn't much to work with, and your code will be fairly simple. Give it a try with small strings, see how it goes;

Re: Wrapping around a list

2013-11-27 Thread Amjad Syed
On Wednesday, November 27, 2013 1:53:54 PM UTC+3, Chris Angelico wrote: > On Wed, Nov 27, 2013 at 9:46 PM, wrote: > > > So the question i am asking , how can i add wrapping around sublist in my > > sliding window function. > > > > By the look of what you now have, the easiest way would proba

Re: Wrapping around a list

2013-11-27 Thread Chris Angelico
On Wed, Nov 27, 2013 at 9:46 PM, wrote: > So the question i am asking , how can i add wrapping around sublist in my > sliding window function. By the look of what you now have, the easiest way would probably be to duplicate the list before you slide. So instead of working on "LEQN", you work on