Problem 7 Python solution.
Result assert for Problem 7.