Problem 2 Java and Python