Tyler Smith wrote: > That cleaned up a lot. However, I couldn't figure out a way to do > random.choice(word_hash[(w1, w2)]) on a dict with set-type values.
Ah, sorry; random.choice() needs an indexable sequence. Try w1, w2 = w2, random.sample(word_hash[(w1, w2)], 1)[0] random.sample() works with any iterable, not just sequences. It returns a list, hence the indexing [0]. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor