Python Loop Through Two Dimensional Vs One Dimensional