Python String Slicing
kodingwindow@kw:~$ python3
...
>>> kw="Kodingwindow"
>>> kw
'Kodingwindow'

>>> len(kw)
12

>>> kw[0]
'K'

>>> kw[11]
'w'

>>> kw[0:12:1] 'Kodingwindow' >> kw[0:12:2] 'Kdnwno' >>> kw[0:12:3] 'Kiwd' >>> kw[::-1] reverse the given string 'wodniwgnidoK'
>>> kw[::1] 'Kodingwindow' >>> kw[::2] 'Kdnwno' >>> kw[::3] 'Kiwd'
>>> kw[1::] 'odingwindow' >>> kw[2::] 'dingwindow' >>> kw[3::] 'ingwindow'
Advertisement