problem 9, in Python
problem 8, in Python
problem 6, in Python