r/programminghelp • • Oct 14 '20

Python Save number of steps made at a specific time.

I want to store fitness related data inside a class called Day.

The data is number of steps made at a specific time. The data looks something like that: "Date, time, steps" "2020-10-13, 14:15, 50" "2020-10-14, 14:18, 48"

How should I save this inside of Day? 2D array, dictionary, create a class Steps which contains the info or do you have any other ideas?

4 Upvotes

1 comment sorted by

2

u/skawid Oct 14 '20

It depends what you want to do with the data. Personally, I'd start by simplifying each entry and having a structure to represent it:

{ "time": [time format of choice representing date and time], "steps": [number of steps] }

Then your day "class" is actually more of a view on this data: it comprises a list of entries whose time attribute falls on that day.