get next element while looping code example Example: get next element while looping arr = [1,2,3,4] arr = iter(arr) for x in arr: print(x, next(arr))