Why not compact these lines into one with the ``range`` statement?  It wouldn't harm readability.