raw strings modules after the def line comes the function' docstringlaid out conventionally with single line descriptiona blank linefurther descriptionand then some examples written as though they were typed in interactively because the quoted strings are inside docstring we must either escape the backslashes inside themor do what we have done here and use raw triple quoted string result [word "for char in textif char in deletecontinue elif char in whitespaceif wordresult append(wordword "elseword +char if wordresult append(wordreturn join(resultthe result list is used to hold "words"--strings that have no whitespace or deleted characters the given text is iterated over character by characterwith deleted characters skipped if whitespace character is encountered and word is in the makingthe word is added to the result list and set to be an empty stringotherwisethe whitespace is skipped any other character is added to the word being built up at the end single string is returned consisting of all the words in the result list joined with single space between each one the is_balanced(function follows the same pattern of having def linethen docstring with single-line descriptiona blank linefurther descriptionand some examplesand then the code itself here is the code without the docstringdef is_balanced(textbrackets="()[]{}")counts {left_for_right {for leftright in zip(brackets[:: ]brackets[ :: ])assert left !right"the bracket characters must differcounts[left left_for_right[rightleft for in textif in countscounts[ + elif in left_for_rightleft left_for_right[