Python Forum
Moving to Functional
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving to Functional
#2
I would try the following
from itertools import groupby
def report():
    data = Load()
    report = []
    for date, irec in groupby(data, key=lambda r: RecToDate(r)):
        irec = list(irec)
        counts = [0] * 10
        for rec in irec:
            for j in range(10):
                counts[j] += RecRan(rec, j)
            report.append(str(rec))
        report.append(Summary(len(irec), counts))
    return ''.join(report)
Reply


Messages In This Thread
Moving to Functional - by swisscheese - Dec-13-2020, 09:30 PM
RE: Moving to Functional - by Gribouillis - Dec-14-2020, 08:56 AM
RE: Moving to Functional - by swisscheese - Dec-14-2020, 01:41 PM
RE: Moving to Functional - by swisscheese - Dec-14-2020, 09:22 PM
RE: Moving to Functional - by Gribouillis - Dec-15-2020, 05:26 AM
RE: Moving to Functional - by swisscheese - Dec-15-2020, 10:27 AM
RE: Moving to Functional - by Gribouillis - Dec-15-2020, 05:45 PM
RE: Moving to Functional - by swisscheese - Dec-15-2020, 08:08 PM
RE: Moving to Functional - by Gribouillis - Dec-15-2020, 08:42 PM
RE: Moving to Functional - by ndc85430 - Dec-16-2020, 07:09 AM
RE: Moving to Functional - by Gribouillis - Dec-16-2020, 07:52 AM
RE: Moving to Functional - by swisscheese - Dec-17-2020, 12:57 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020