Python code from Introdiction To Python