def days_difference(day1, day2):
''' (int, int) -> int
Return the number of days from the first parameter to the second parameter,
which are both in the range 1-365 (and thus indicate a day of the year).
'''
return day2-day1
def get_weekday(d1, d2):
''' (int, int) -> int
The first parameter indicates the current day of the week, and is in the
range 1-7. The second parameter indicates a number of days from the current
day, and that could be any integer, including a negative integer. Return
which day of the week it will be that many days from the current day.
'''
weekday = (d1+d2) % 7 or 7
return weekday
def get_birthday_weekday(d1, d2, d3):
''' (int, int, int) -> int
The first parameter indicates the current day of the week, and is in the
range 1-7. The second parameter indicates the current day of the year, and
is in the range 1-365. The third parameter indicates which day of the year
a birthday falls on, and is also in the range 1-365. Return the day of the
week it will be on that birthday (a number in the range 1-7). Hint: call
the other two functions to do part of the work for you.
'''
d = (days_difference(d2, d3))
d_final = get_weekday(d1, d)
return d_final
Hi, ive done these functions, but maybe could you guys check for any possible errors?
thank you
sunday is 1, monday is 2 and .... sat is 7