- monthrange() is a python function which return the first week day and the number of days in the given month.
Syntax-
calendar.monthrange(year,month)
program-
#import calendar module
import calendar
print("Enter year")
y=int(input())
print("Enter month")
m=int(input())
t=calendar.monthrange(y,m)
print(t)
print("Number of days is",t[1])
Enter year
2019
Enter month
2
(4, 28)
Number of days is 28