Tweak programming faq examples so that it (mostly) passes doctest.

Back port of 0113247f894b from 3.3.

The exceptions are the import related questions at the end, which
need to be rewritten anyway, and a math example that doesn't
exist in the 3.3+ docs that I didn't bother trying to fix.