day_after(day_index, offset) that simulates cycling through a 7-day week represented as indices 0-6 (0=Monday ... 6=Sunday). Given a starting day_index and an offset (which may be large or negative), return the resulting day index, always in the range 0-6, using the modulo operator.day_after(5, 3)
1
(5 + 3) % 7 = 1.
day_after(0, -1)
6
Wrapping backward from Monday lands on Sunday (index 6) thanks to Python modulo semantics.
Python's % always returns a non-negative result when the divisor is positive, even for negative operands — exploit that.