Python Loop Through Array And Its Types