Python version of hw 4. Corrected doc in java version