modify source code file listing4-2.py in Chapter04