"normalizing" a value

Paul Rubin no.email at nospam.invalid
Thu Jul 2 02:36:21 CEST 2015


bvdp <bob at mellowood.ca> writes:
>    while x < 0: x += 12
>    while x >= 12: x -= 12
> Okay, that works. Just wondering if there is an easier (or faster) way
> to accomplish this.

x = x % 12

should be the same as the above.  But are you sure that's really what
you want?


More information about the Python-list mailing list