I met an interesting issue yesterday with the Basta Fazoolin’ exercise when it asked “create an available_menus() method that takes in a time parameter and returns a list of the Menu objects that are available at that time.”
The obvious issue is at this point in the cs path, time and datetime modules aren’t mentioned. So the only tools to compare hours would be to parse strings (like 11AM) and give them a 24 hr format with conditionals. Which all felt a little inefficient and roundabout.
I found that to be a great opportunity to look into better ways to approach this function, but surprisingly there is very little entry level material for the datetime module (I searched for quite a bit on google, and have the big O’Reilly book). The official Python documentation is indeed informative, but it can be daunting and for a specific need wasn’t giving me what I needed.
However I did come across a thorough video that set up a lot of good principal ideas, and from there it was easy to devise how I could finally write the function I wanted. Here’s the link if you’re interested (https://www.youtube.com/watch?v=eirjjyP2qcQ).
I hope this gives some ideas to fellow learners, and if CA people see this, intro courses (or links) into handling time could be nice touch in the future