python extract string

# string [start:end:step]
string = "freeCodeCamp"
print(string[0:len(string)-1])		# freeCodeCam
print(string[0:5])		            # freeC
print(string[2:6])		            # eeCo
print(string[-1])		            # p
print(string[-5:])		            # eCamp
print(string[1:-4])                 # reeCode
print(string[-5:-2])	            # eCa
print(string[::2])		            # feCdCm

Here is what the above code is Doing:
1. string[0:len(string)-1]
– start at index 0
– end at index len(string)-1
– step by 1
2. string[0:5]
– start at index 0
– end at index 5
– step by 1
3. string[2:6]
– start at index 2
– end at index 6
– step by 1
4. string[-1]
– start at index -1
– end at index -1
– step by 1
5. string[-5:]
– start at index -5
– end at index -1
– step by 1
6. string[1:-4]
– start at index 1
– end at index -4
– step by 1
7. string[-5:-2]
– start at index -5
– end at index -2
– step by 1
8. string[::2]
– start at index 0
– end at index len(string)-1
– step by 2