<div dir="ltr">To whom it may concern,<div><br></div><div style>I believe I have found a minor error in the example given on String "slicing" in section 3.1.2. "Strings" of "The Python Tutorial" documentation. </div>
<div style><br></div><div style>The error concerns the first example of slicing given (where the variable "word" is equal to "Python"), which reads:</div><div style><pre style="padding:5px;background-color:rgb(238,255,204);color:rgb(51,51,51);line-height:17.77777862548828px;border:1px solid rgb(170,204,153);font-family:monospace,sans-serif;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<font size="1"><span class="" style="color:rgb(198,93,9);font-weight:bold">>>> </span><span class="">word</span><span class="">[</span><span class="" style="color:rgb(32,128,80)">0</span><span class="">:</span><span class="" style="color:rgb(32,128,80)">2</span><span class="">]</span>  <span class="" style="color:rgb(64,128,144);font-style:italic"># characters from position 0 (included) to 2 (excluded)</span>
<span class="" style="color:rgb(51,51,51)">'Py'</span>
<span class="" style="color:rgb(198,93,9);font-weight:bold">>>> </span><span class="">word</span><span class="">[</span><span class="" style="color:rgb(32,128,80)">2</span><span class="">:</span><span class="" style="color:rgb(32,128,80)">5</span><span class="">]</span>  <span class="" style="color:rgb(64,128,144);font-style:italic"># characters from position 2 (included) to 4 (excluded)</span>
<span class="" style="color:rgb(51,51,51)">'tho'</span></font></pre></div><div style>I believe the second comment is incorrect as the character at the 4th index "o" is included. I propose that the comment should be changed so that "excluded" is changed to "included" as below:</div>
<div style><pre style="padding:5px;background-color:rgb(238,255,204);color:rgb(51,51,51);line-height:17.77777862548828px;border:1px solid rgb(170,204,153);font-family:monospace,sans-serif;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<font size="1"><span class="" style="color:rgb(198,93,9);font-weight:bold">>>> </span><span class="">word</span><span class="">[</span><span class="" style="color:rgb(32,128,80)">0</span><span class="">:</span><span class="" style="color:rgb(32,128,80)">2</span><span class="">]</span>  <span class="" style="color:rgb(64,128,144);font-style:italic"># characters from position 0 (included) to 2 (excluded)</span>
<span class="" style="color:rgb(51,51,51)">'Py'</span>
<span class="" style="color:rgb(198,93,9);font-weight:bold">>>> </span><span class="">word</span><span class="">[</span><span class="" style="color:rgb(32,128,80)">2</span><span class="">:</span><span class="" style="color:rgb(32,128,80)">5</span><span class="">]</span>  <span class="" style="color:rgb(64,128,144);font-style:italic"># characters from position 2 (included) to 4 (included)</span>
<span class="" style="color:rgb(51,51,51)">'tho'</span></font></pre></div><div style>This could also be solved by changing the 4 to a 5 however that statement would be making the same point as the first and would therefore be redundant. </div>
<div style><br></div><div style>Kind Regards,</div><div style><br></div><div style>Christopher Brautigam</div><div style><br></div></div>