Python Program to Display Calendar

Python Program to Display Calendar: Python has a built-in function, calendar to work with date-related tasks. You will learn to display the calendar of a given date in this example.

In the program below, we import the calendar module. The built-in function month() inside the module takes in the year and the month and displays the calendar for that month of the year.

Python Program to Display Calendar

Source Code

# Program to display calendar of the given month and year

# importing calendar module
import calendar

yy = 2014  # year
mm = 11    # month

# To take month and year input from the user
# yy = int(input("Enter year: "))
# mm = int(input("Enter month: "))

# display the calendar
print(calendar.month(yy, mm))

Output of Program