[docs] Correction in PYTHON 3 Doc tutorial.pdf

Zachary Ware zachary.ware+pydocs at gmail.com
Fri Mar 25 02:18:28 EDT 2016


Hi Amir,

On Fri, Mar 25, 2016 at 12:54 AM, amir malik <amirmalik.007 at gmail.com> wrote:
> Hi team,
>
> I downloaded the doc from below URL:
> https://docs.python.org/3/download.html
>
> PDF (A4 paper size)Download (ca. 8 MB)
>
> I downloaded the packed as .zip file & unzipped it and started with
> docs-pdf/tutorial.pdf
>
> 3.1.3 Lists:
>
> At page No: 12

More simply, this is at
https://docs.python.org/3/tutorial/introduction.html#lists

> letters[2:5] = ['C', 'D', 'E']
>
> should be corrected to letters[2:4] = ['C', 'D', 'E']

This is actually correct as written.  Try it!

   >>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
   >>> letters[2:5]
   ['c', 'd', 'e']
   >>> letters[2:5] = ['C', 'D', 'E']
   >>> letters
   ['a', 'b', 'C', 'D', 'E', 'f', 'g']
   >>> letters[2:4] = ['c', 'd', 'e']
   >>> letters
   ['a', 'b', 'c', 'd', 'e', 'E', 'f', 'g']

Remember that in Python, slicing ([2:5]) means "start at position 2,
and give me everything up to (but not including) 5", which yields the
values at indexes 2, 3, and 4.

Thanks for the report anyway, we do appreciate it.

Regards,
-- 
Zach


More information about the docs mailing list