Python codes for assignment from IEMS 5723