Days Until Summer

calendar-date-time

Did you know?

Summer starts on the Summer Solstice which, in the Northern hemisphere, is the 21st of June. It ends three months later, on September the 22nd, a date known as known as Autumnal equinox, when the Autumn season starts.

For this challenge you will write a Python script that retrieves today’s date to find out if we are in Summer or not. If not, it will calculate the number of days until next Summer, which could be in the same calendar year or in the following calendar year (in case we have already passed this year Summer season).

To do so we will reuse and adapt the following code used to calculate the number of days until next Christmas. Your task is to analyse how this code works to then make the necessary amendments to:

  • Find out if we are already in the Summer season,
  • if, not find out if this year Summer is already past,
    • if it has, calculate the number of days left till next year Summer,
    • otherwise, calculate the number of days till this year Summer.

Python Code


Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with:

Our Latest Book

Follow this blog