Wrapping around a list in Python.

shengjie.shengjie at live.com shengjie.shengjie at live.com
Mon Dec 16 00:26:57 EST 2013


On Monday, 16 December 2013 12:38:14 UTC+8, shengjie... at 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 would overwrite the first value.
> 
> [0,1,2,3]
> 
> [4,1,2,3]
> 
> [5,4,1,2]
> 
> 
> 
> Thanks in advance and much help appreciated.



More information about the Python-list mailing list