python: Use enumerate() builtin function to simplify counted iteration.