Solve problems 42,49 using Python.