Knowledge organisersString Manipulation
Extract part of a string.
Slicing extracts a portion of a string using [start:end]. The start index is included, the end index is excluded. Indices start at 0.
text[0] is the first charactertext[0:3] gives characters at index 0, 1, 2text[-1] is the last charactertext[:3] means from start to index 2text[3:] means from index 3 to the endword = "Python"
print(word[0]) # P
print(word[0:3]) # Pyt
print(word[-1]) # n
print(word[2:]) # thon