add Solution for problem 6 and 7 in Python version