JPMorganChase Interview Question

Coding up a simple for loop.