I\'m writing a django model that allows my site to have coupons.
Coupons can have three types: lifetime account voucher, certain period of months voucher, certain numb
If you have Python2.7 or newer
from collections import Counter items_to_test = (self.months, self.dollars, self.lifetime) true_count = Counter(map(bool, items_to_test))[True]