refactor perfect game for python lang test