Execute a Markov algorithm: Difference between revisions

(→‎{{header|Python}}: Add stretch goal solution)
Line 154:
return [ (matchobj.group('pat'), matchobj.group('repl'), bool(matchobj.group('term')))
for matchobj in re.finditer(syntaxre, grammar)
if matchobj.groupdictgroup()['rule'])]
 
def replace(text, replacements):
Anonymous user