The program starts by importing the calendar module from the Python Standard Library, which provides functions for working with calendars. Two variables, year and month, are created and set to the values 1975 and 2, respectively.
The calendar.monthrange function is called with the year and month as arguments, which returns a tuple with two values: the first day of the week of the first day of the month (where Monday is 0 and Sunday is 6), and the number of days in the month. The second value of the tuple is retrieved using indexing [1], and is stored in the variable days_in_month. Finally, the result of the calculation is printed using the print function.
import calendar year = 1975 month = 2 print(calendar.monthrange(year, month)[1])
28
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions