Python Function to Display Calendar

Created with Sketch.

Python Function to Display Calendar

In Python, we can display the calendar of any month of any year by importing the calendar module.

See this example:

  1. # First import the calendar module
  2. import calendar
  3. # ask of month and year
  4. yy = int(input(“Enter year: “))
  5. mm = int(input(“Enter month: “))
  6. # display the calendar
  7. print(calendar.month(yy,mm))

Output:

Python Function Programs7

Leave a Reply

Your email address will not be published. Required fields are marked *