python code in Chapter1