update cbb520 hw2 part5 python code