<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1485618539052_7872">Hi Python Developers,</div><div id="yui_3_16_0_ym19_1_1485618539052_7873"><br id="yui_3_16_0_ym19_1_1485618539052_7874"></div><div id="yui_3_16_0_ym19_1_1485618539052_7875">print() function has a slight design issue, when user gives start and end positions of character array.</div><div id="yui_3_16_0_ym19_1_1485618539052_7876">Issue:</div><div id="yui_3_16_0_ym19_1_1485618539052_7877"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7878"> </span>>>> str_ary="abcdef"</div><div id="yui_3_16_0_ym19_1_1485618539052_7879"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7880"> </span>>>> print(str_ary[1])</div><div id="yui_3_16_0_ym19_1_1485618539052_7881"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7882"> </span>b</div><div id="yui_3_16_0_ym19_1_1485618539052_7883"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7884"> </span>>>> print(str_ary[4])</div><div id="yui_3_16_0_ym19_1_1485618539052_7885"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7886"> </span>e</div><div id="yui_3_16_0_ym19_1_1485618539052_7887"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7888"> </span>>>> print(str_ary[1:4])</div><div id="yui_3_16_0_ym19_1_1485618539052_7889"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7890"> </span>bcd</div><div id="yui_3_16_0_ym19_1_1485618539052_7891"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7892"> </span>>>> </div><div id="yui_3_16_0_ym19_1_1485618539052_7893"><br id="yui_3_16_0_ym19_1_1485618539052_7894"></div><div id="yui_3_16_0_ym19_1_1485618539052_7895"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7896"> </span>In the above scenario, user is expecting that output of print function will be bcde (not bcd).</div><div id="yui_3_16_0_ym19_1_1485618539052_7897"><br id="yui_3_16_0_ym19_1_1485618539052_7898"></div><div id="yui_3_16_0_ym19_1_1485618539052_7899">Analysis:</div><div id="yui_3_16_0_ym19_1_1485618539052_7900"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7901"> </span>I kind of figured out what could be the issue. </div><div id="yui_3_16_0_ym19_1_1485618539052_7902"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7903"> </span>To get the string slice, "between" (or equivalent) was used.</div><div id="yui_3_16_0_ym19_1_1485618539052_7904"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7905"> </span>i.e. str_ary array position >=1 and < 4</div><div id="yui_3_16_0_ym19_1_1485618539052_7906"><span style="white-space:pre-wrap;" id="yui_3_16_0_ym19_1_1485618539052_7907"> </span></div><div id="yui_3_16_0_ym19_1_1485618539052_7908">Solution:</div><div id="yui_3_16_0_ym19_1_1485618539052_7909"> User experience will be better if the code is updated to get last character.</div><div id="yui_3_16_0_ym19_1_1485618539052_7910"> i.e str_ary array position >=1 and <= 4</div><div id="yui_3_16_0_ym19_1_1485618539052_7911"><br id="yui_3_16_0_ym19_1_1485618539052_7912"></div><div id="yui_3_16_0_ym19_1_1485618539052_7913">Note:</div><div id="yui_3_16_0_ym19_1_1485618539052_7914"> To keep the code as backward compatibility, you may come up with different name like printf()</div><div id="yui_3_16_0_ym19_1_1485618539052_7915"> </div><div id="yui_3_16_0_ym19_1_1485618539052_7916"><br id="yui_3_16_0_ym19_1_1485618539052_7917"></div><div id="yui_3_16_0_ym19_1_1485618539052_7918">Thanks</div><div id="yui_3_16_0_ym19_1_1485618539052_7919">Ravi Yarlagadda </div><div dir="ltr" id="yui_3_16_0_ym19_1_1485618539052_7920"><br id="yui_3_16_0_ym19_1_1485618539052_7921"></div></div></body></html>