I started trying:
(date.minute + 1) % 5
Later, I discovered that date.minute is not necessarily continuous. After 03 minutes, it is not necessarily 04 minutes. It may jump directly to 06 minutes.
So I need to be evenly divisible by 5 as the interval, and then count upwards.
For example, if the interval is 5, replace 6 with 5, 9 with 5, 10 with 10, and 14 with 10.
>Solution :
Try utilizing floor division i.e., // 5:
>>> testcases = [6, 9, 10, 14]
>>> for tc in testcases:
... print(f'{tc} -> {tc // 5 * 5}')
...
6 -> 5
9 -> 5
10 -> 10
14 -> 10