Bill Mill wrote: > However, where will it be pointing in 16 hours? Well, in 12 hours it > will be at the one, then four more hours later it will be pointing at > the five. This can be represented as: > > 1 + (16 % 12) = 1 + 4 = 5
Correcter is (1 + 16) % 12 = 17 % 12 = 5 > In general, the hour at some point in the future will be: > > (start time) + (hours in the future % 12) (start time + hours in the future) % 12 The difference can be seen in a small example: suppose it is 10 o'clock, and you want to know what it will be in 6 hours. Your formula gives 10 + (6 % 12) = 10 + 6 = 16 which is not correct (unless dealing with 24-hour systems of course, but that's not the case here) Correct is: (10 + 6) % 12 = 16 % 12 = 4 (In 24-hour systems, just replace 12 with 24) -- "Codito ergo sum" Roel Schroeven _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor