Python String Slicing
godarda@gd:~$ python3
...
>>> gd="GoDarda"
>>> gd
'GoDarda'

>>> len(gd)
12

>>> gd[0]
'K'

>>> gd[11]
'w'

>>> gd[0:12:1] 'GoDarda' >> gd[0:12:2] 'KdnWno' >>> gd[0:12:3] 'KiWd' >>> gd[::-1] reverse the given string 'wodniWgnidoK'
>>> gd[::1] 'GoDarda' >>> gd[::2] 'KdnWno' >>> gd[::3] 'KiWd'
>>> gd[1::] 'odingWindow' >>> gd[2::] 'dingWindow' >>> gd[3::] 'ingWindow'
Comments and Reactions