Python Tutorial

The calendar module offers different functions and tools when working with dates. One of the most useful functions of the calendar module is the monthrange function – returns weekday of first day and number of days in a given month.

In this tutorial we will learn how to use the calendar.monthrange function to figure out the first weekday and last day of a month in Python.