Python Forum

Full Version: How to calculate a months' 1st, 4th, 7th day and also 1st again?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone, I just started how to learn to code.
I am trying to write a program that should count the days an athlete decides to run once every three days for the whole year
(On the 1st, 4th, 7th ... day of each month).
At the beginning of a new month, he always runs on the 1st day of the month, even if three days have not passed since his last run.


for x in range(1,32,3):
    print(x)
This is the code I wrote for counting every three days but I couldn't find a solution for how to add the first days of months.
A little help with this would be perfect. Rolleyes
A bit more information would be helpful. What is this program supposed to do? Does it pop up a message to let you know you are going to run today? Does it generate a list of days when you are going to run? Is there anything that you enter to run the program? Do you tell it what the month is or does it print out a schedule for the entire year?

What is wrong with [1,4,7,10,13,16,19,22,25,28] and maybe 31. Is the "maybe 31" part where you are having difficulty?