will my code keep running when Mac is in sleep mode?
Solution 1:
In short... No.
It's an either/or.
Either your code is running...
...or your machine is asleep.
You cannot have both at once.
Whatever is running may prevent sleep, or it may not.
You can test for that in Activity Monitor [Applications/Utilities] If you right click any of the headers & add 'Preventing sleep' you'll be able to tell if anything will prevent it or will just allow the machine to sleep at the set time.