strings the basic structure is string name[starting location ending location+ slices have the same quirk as the range function in that they do not include the ending location for instancein the example aboves[ : gives the characters in indices and but not the character in index we can leave either the starting or ending locations blank if we leave the starting location blankit defaults to the start of the string so [: gives the first five characters of if we leave the ending location blankit defaults to the end of the string so [ :will give all the characters from index to the end if we use negative indiceswe can get the ending characters of the string for instances[- :gives the last two characters there is an optional third argumentjust like in the range statementthat can specify the step for examples[ : : steps through the string by twosselecting the characters at indices and (but not because of the aforementioned quirkthe most useful step is - which steps backwards through the stringreversing the order of the characters changing individual characters of string suppose we have string called and we want to change the character at index of to 'xit is tempting to try [ ]=' 'but that unfortunately will not work python strings are immutablewhich means we can' modify any part of them there is more on why this is in section if we want to change character of swe have to instead build new string from and reassign it to here is code that will change the character at index to ' ' [: ' [ :the idea of this is we take all the characters up to index then xand then all of the characters after index looping very often we will want to scan through string one character at time for loop like the one below can be used to do that it loops through string called sprinting the stringcharacter by charactereach on separate linefor in range(len( ))print ( [ ]in the range statement we have len(sthat returns how long is soif were characters longthis would be like having range( and the loop variable would run from to this means that [iwill run through the characters of this way of looping is useful if we need to keep track of our location in the string during the loop if we don' need to keep track of our locationthen there is simpler type of loop we can use