''' Purpose: consider string replace() functions ''' text = input( "Enter text: " ) s = input( "Enter substring (s): " ) r = input( "Enter substring (r): " ) print() # get version of text with occurrences of s replaced with r # NEW FUNCTION: replace() -> text.replace(substring, what we wanna replace it with) -> returns # copy of string with each instance of s replaced with r below # s = 'hello' # new_string = s.replace('ll', 'yy') # new_string is 'heyyo' modified_text = text.replace( s, r ) print( "text.replace( s, r ):", modified_text, " # text's s's replaced with r's" ) # Hitting the enter key for r is the same as providing an empty string '' # s = 'yellow bellied sap sucker' # modified_text = text.replace('e','') -> puts an empty string there (basically gets rid of those characters) # e's become '' # yllow bllid sap suckr # '' is not ' ' # empty string vs. space # Length 0 Length 1