[Tutor] Explanation of Lists data Type

Pujo Aji ajikoe at gmail.com
Wed Apr 12 11:32:10 CEST 2006


Hello,


On 4/12/06, Kaushal Shriyan <kaushalshriyan at gmail.com> wrote:
>
> Hi All
>
> I am referring to http://www.ibiblio.org/obp/thinkCSpy/chap08.htm
>
> 8.7 List slices
> --------------------------------------------
> >>> list = ['a', 'b', 'c', 'd', 'e', 'f']
> >>> list[1:3]
> ['b', 'c']  -----> I understood this




>>> list[:4]  -->  Does this mean its list[0:4]

   ':' here means --> from the first element to element index 4

> ['a', 'b', 'c', 'd']  ----> I didnot understood this




>>> list[3:] -->  Does this mean its list[3:0]

   ':' here means --> from element index 3 to the last element
  ['d', 'e', 'f'] ----> I didnot understood this



>>> list[:] -->  Does this mean its list[0:0]

   ':' here means --> from the first element to the last element

> ['a', 'b', 'c', 'd', 'e', 'f'] ----> I didnot understood this




Please explain me
>
> Thanks in Advance
>
> Regards
>
> Kaushal




Hope, this helps
pujo


_______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060412/10110cd1/attachment.html 


More information about the Tutor mailing list