Adapt print statements in examples for Python 3 compatibility

Addresses #1201.