Python lists outside of range -
how can move forward item in list past range? example, if set alarm @ 2pm , want go off in 59 hours, time be?
i code this, fails past range of 25:
time = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24) print(time[15+59])
this has nothing python, modular arithmetic:
print(time[(14 - 1 + 59) % 24])
prints
1
Comments
Post a Comment