Completed part 2 in python