''' Purpose: consider string find() function ''' text = input( "Enter text: " ) substring = input( "Enter substring: " ) print() ### find occurrences # NEW FUNCTION: find() -> s.find( what we want to find ) -> tells us index of where substring occurs # If it occurs, it'll give us the index! Otherwise, it'll give us -1 (not found) i1 = text.find( substring ) # Finds the first occurence of substring i2 = text.find( substring, i1 + 1 ) # Finds the occurence - starts to look at the specified index and beyond i3 = text.find( substring, i2 + 1 ) # Finds the occurence - starts to look at the specified index and beyond print( "text.find( substring ):", i1, " # first occurrence" ) print( "text.find( substring,", i1 + 1, "):", i2, " # second occurrence" ) print( "text.find( substring,", i2 + 1, "):", i3, " # third occurrence" )