powered by
Next position to i in a cycle.
next_index(i, n)
The next position in cycle
Position in cycle
Length of cycle
Cesar Asensio
In a cycle, the next slot to the i-th position is i+1 unless i=n. In this case, the next is 1.
next_index(5, 7) # 6 next_index(7, 7) # 1
Run the code above in your browser using DataLab