def output_totals(days_in_past, totals):

    sum_all = 0

    if (days_in_past):
        print "Last %d day(s) ===========" % days_in_past
    else:
        print "All time ==========="
    for total in totals:
        print (total['_id'], total['totalItems']) % "%s: %d"
        sum_all = sum_all + total['totalItems']

    print "TOTAL: %d" % sum_all
    print "\n"
dataset/ETHPy150Open fictivekin/openrecipes/scripts/mongo_stats.py/output_totals/swapped operands of `%`