0
Next occurrence of today's date
Next occurrence of today's date, as in same day, day name, month.
6 Answers
+ 4
That sounds like having to do with leap years.
We're all expected to show our attempt, btw.
+ 3
We don't usually answer homework assignments here. However, If you show your attempt someone may provide some assistance.
+ 2
Editing:
Removed my stuff since finding the shift in weekdays by 1.24 increments(each day in the following year shifting by that much) and applying mod 7, the way I tried it, doesn't output results that apply to all cases.
So let me share with you this link:
https://www.quora.com/How-often-in-years-do-calendars-repeat-with-the-same-day-date-combinations
However, I don't think the info given here especially by the postal person is how you're meant to solve it. (I don't know how you're meant to solve it)
There's probably some other way that makes more sense for coding. I am interested in what the mentors will say but they won't help unless you show an attempt. So I'm gonna squat here until that happens :D
+ 2
So if I understand you correctly, you want to input a date, and as a return, you want to find out the next year that has the same day and month as the inputed date, but also has the same weekday as the inputed date.
If you use tools from an appropriate module, it's a really simple problem to solve.
1) you need functions (or methods) so you can input a year, a month and a day for a date and return its weekday. This type of functions can be found in the module 'datetime' (that you have to import).
2) Set up a loop, that for every test year, tests if the date with same the month and day as the inputed date, also has the same weekday as the inputed date. Do this for every next comming years, unitill you find the year youâre searching for. (Just increase the year in every loop: yr += 1)
One tip is to begin to study datetime() and its datetime(y, m, d).weekday() in the datetime module. Use help() for help:
from datetime import datetime
help(datetime)
+ 1
Is it a poser?
0
Like today is Friday and date is July 8,
In which upcoming year, the day is Fri on July 08.