Python Forum
Moving to Functional
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving to Functional
#1
Can anyone help explain how to make this snippet follow a more functional style? I was able to functionalize other portions of the code but having trouble with this.
def Report ():
    data = Load ()
    Report = ""
    LastDate = GetDate (data[0])
    Count = 0; Counts = [0,0,0,0,0,0,0,0,0,0]
    for rec in data:
        Count += 1
        ThisDate = RecToDate (rec)
        if ThisDate != LastDate:
            Report += Summary (Count,Counts)
            Count = 0; Counts = [0,0,0,0,0,0,0,0,0,0]
            LastDate = ThisDate
        for j in range (10): Counts[j] += RecRan (rec,j)
        Report += str (rec)
    return 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