#!/usr/bin/python3 def removeHtmlMarkup(s): tag = False quote = False out = "" for c in s: if c == '<' and not quote: # Start of markup tag = True elif c == '>' and not quote: # End of markup tag = False elif c == '"' or c == "'" and tag: # Quote quote = not quote elif not tag: out = out + c return out """ Our hypotheses """ if __name__ == "__main__": print (removeHtmlMarkup('"foo"'), '\tExpect "foo"\tHypothesis: foo') # Test the hypothesis about bar # print (removeHtmlMarkup('"bar"'), '\tExpect "bar"\tHypothesis: [BLANK]') # Test if it matters whether there is anything else present # print (removeHtmlMarkup('""'), '\tExpect ""\tHypothesis: [BLANK]')