Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

python code

Name: what could this be for? 2009-12-06 22:04

self.hours = 1 + (self.hours - 1) % 12

Name: Anonymous 2009-12-06 22:32

Obviously written by a moran.  It evaluates to:

self.hours = self.hours % 12

Which sets self.hours to a value from 0..11 depending on the remainder after dividing it by 12.  I can't see any surrounding code, but I guess it could be used when you have a number of hours representing 24-hour time and you just wanted to know which hour /12 that would be when using AM/PM instead of 24-hour time.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List