String ranges
A common task is to get a small section of characters from a string. This is sometimes referred to as a sub-string or substr for short! In python sub-strings are easy peasy! You just use the same syntax as the last exercise to specify the start letter and then say the end letter. In the example below the text “some” starts at position 8 and ends at positon 12. By saying text[8:12] we can get the text some out!
text = "this is some text" print text[8:12]
Alter the code above to get the word “is” out!
Output: (clear)











