Replaced range(len(collection)) with enumerate(collection)
Replaced insufficient for loop with map
Fixed parentheses
Merge pull request #6976 from malinoff/fixed-range-syntax

Fixed range syntax