Completed solution.py for part 1 of the exercise.