Dec-15-2020, 10:27 AM
I wonder how to minimize loops and variables. Overall the code is still imperative.
def CountRuns (rec,counts): for j in range(10): counts[j] += RecRan(rec, j) def Report (): data = Load () report = [] for date, irec in groupby(data, key=RecToDate): irec = list(irec) counts = [0] * 10 for rec in irec: CountRuns (rec,counts) report.append(StrRec(rec)) report.append(Summary(len(irec), counts, Strdate(date))) return ''.join(report)