Add solution for problem 4 in Scala. Start adding solutions in Python.