Solved Problem 1 with numpy