word = 'Python' word[:2] # character from the beginning to position 2 (excluded) # 'Py' word[4:] # characters from position 4 (included) to the end # 'on' word[-2:] # characters from the second-last (included) to the end # 'on'
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter