better general solution problem 1 python