End of Summer - hours only!Up to 80% off on all courses and bundles.-Close
8. Question 7


Great job! One more question to go!


Write a function named get_first_and_last_sundays(input_datetime) that accepts a datetime argument and returns a tuple with two elements: the date of the first Sunday and the last Sunday of the same year as the datetime argument.

Stuck? Here's a hint!

Import the datetime module. You can create a variable pointing to January 1st of the input_datetime year. Then, inside a while loop, add a timedelta of one day until you get the first Sunday of the year. Use a similar procedure for the last Sunday.