[thelist] mod (%) help

Brian Cummiskey Brian at hondaswap.com
Wed Jul 16 19:21:40 CDT 2008


Hey guys,

pulling my hair out on this mod problem.


I'm working on checking and totally up a kit.   a kit consists of a lift 
and 4 wheels.

When a complete kit is there, all is well and a discount is applied.

ie, they order a lift and 2 wheels, no discount
ie, they order a lift and 4 wheels both lift and wheels are discounted
ie, they order a lift and 6 wheels, only 4 wheels and lift will be sold 
at the discount price, 2 at regular
ie, they order a lift and 8 wheels, only 4 wheels and lift will be sold 
at the discount price, 4 at regular price.

I'm trying to count 'extras'.   I'm struggling on how to add the 
multiples with modulus.

This is what i came up with but it fails on less than 8 due to adding 1.

    extrawheels = (wheelqty-4) + (wheelqty mod 4)

anyone have a pointer?



More information about the thelist mailing list