Python Loop Through Array And Hashing