[Tutor] How does slicing work?

Kanone Seele k4n0ne at gmail.com
Sat Jun 16 04:48:47 CEST 2012


Hello,I'm a beginner in python.I found some qustions in Chapter 9's Quiz of
the book* Learning Python,4th ed*,

>>> L = [1, 2, 3, 4]

>>> L[-1000:100]

[1, 2, 3, 4]

>>> L[3:1]

[]

>>> L[3:1] = ['?']

>>> L

[1, 2, 3, '?', 4]


How does python get the result of slicing?Such as the examples above,they
really confused me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120616/67361a17/attachment.html>


More information about the Tutor mailing list