You could call me an extreme newbie, I have a course at school for which I need to be able, sort of, to solve problems using python. All so far have worked, but the last one (just a small part really) wont give in.
The first 4 functions work fine (2 arguments each, a birthday (bday) and a random date (today)). They determine whether or not the random date is a birthday/unbirthday/hundredday/sameweekday, returning True or False if so or not, respectively. First line of every function is the following, rest of the script doesn't matter much.
def birthday(bday, today):
def unbirthday(bday, today):
def hundredday(bday, today):
def sameweekday(bday, today):
Again, these work fine.
The last function has to return all dates, between a certain start and end date, on which one of the above variations of birthdays match. First argument is again bday, the next is start (by default bday, this is the asshole), third is end (by default today) and the fourth is birthday (by default the actual birthday).
def birthdays(bday, start=bday, end=date.today(), birthday=birthday):
its the start=bday that won't work, stating that this bday is undefined. Rest of the script doesn't matter as I don't get so far.
(I import datetime in the beginning of script and all first functions work fine using its tools)
end=date.today()you need to doend=Nonein the function definition, and the first line or so, doif end is None:..end = date.today()the reason is that if you program starts at #/#/#### 11:59:59.999 PM it will have the correct date once, the second time is will be wrong