spam 'helloworld!spam[ 'hspam[ 'ospam[- '!spam[ : 'hellospam[: 'hellospam[ :'world!if you specify an indexyou'll get the character at that position in the string if you specify range from one index to anotherthe starting index is included and the ending index is not that' whyif spam is 'helloworld!'spam[ : is 'hellothe substring you get from spam[ : will include everything from spam[ to spam[ ]leaving out the comma at index and the space at index this is similar to how range( will cause for loop to terate up tobut not including note that slicing string does not modify the original string you can capture slice from one variable in separate variable try entering the following into the interactive shellspam 'helloworld!fizz spam[ : fizz 'helloby slicing and storing the resulting substring in another variableyou can have both the whole string and the substring handy for quickeasy access the in and not in operators with strings the in and not in operators can be used with strings just like with list values an expression with two strings joined using in or not in will evaluate to boolean true or false enter the following into the interactive shell'helloin 'helloworldtrue 'helloin 'hellotrue 'helloin 'helloworldfalse 'in 'spamtrue 'catsnot in 'cats and dogsfalse manipulating strings