solving algoriths with python session 2