View Single Post
Old Jan 30th, 2007, 5:55 PM   #8
ptmcg
Newbie
 
Join Date: Aug 2005
Location: Austin, TX
Posts: 15
Rep Power: 0 ptmcg is on a distinguished road
Well, once you get the class junk out of the way, I'd say this is pretty short/elegant, certainly more along the lines of what the OP was looking for.

discount = Percent(20)
origprice = 35.00
saleprice = origprice - discount

Percent is more than just a fancy wrapper around "divide by 100". Note that discount can be subtracted from any number of other values, and it will calculate the respective percentage before returning the value.

Are you the curmudgeon-in-residence on these forums?

-- Paul
ptmcg is offline   Reply With Quote