Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Quiz
8. Question 7
Summary

Instruction

Great job! One more question to go!

Exercise

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.