solution to second python practice problem