foreach in python index code example Example: get index in foreach py for idx, val in enumerate(ints): print(idx, val)