[Solved] IndexError: list index existance range python [closed]


The first condition should be greater or equal because when pat = 24, the program it’s going to the else and then is trying to access the range in the index 24 but the last index is 23.

roue = range(24)
pat = int(input())
if pat >= 24:
    while pat >= 24:
        pat -= 24
else:
    while pat < 0:
        pat += 24
print(roue[pat])

2

solved IndexError: list index existance range python [closed]