djuls
public python v1 · immutabledef output(self, word1=NONWORD, word2=NONWORD): #word1,word2 = NONWORD, NONWORD # Start at beginning output = word1 + " " + word2 for i in range(MAXGEN): successorList = self.dict[(word1,word2)] word3 = random.choice(successorList) if word3 == NONWORD: break output = output + " " + word3 word1, word2 = word2, word3 return output