Program to Display Calendar of a Given Month and Year Using Python

 

Python defines an inbuilt module calendar that handles operations related to the calendar. The calendar module allows output calendars like the program and provides additional useful functions related to the calendar. Functions and classes defined in the Calendar module use an idealized calendar, the current Gregorian calendar extended indefinitely in both directions.




Program to Display Calendar of a Given Month and Year
Code:
import calendar
year=(int(input("Enter year: ")))
mm=(int(input("Enter month: ")))

print(calendar.month(year,mm))
Output:


Program to Display Calendar of a Given Year
Code:
# Python code to demonstrate the working of
# calendar() function to print calendar

# importing calendar module
# for calendar operations
import calendar

# using calendar to print calendar of year
# prints calendar of 2022
print ("The calendar of year 2022 is : ")
print (calendar.calendar(2022))
Output:



AJ Blogs

Hello everyone, My name Arth and I like to write about what I learn. Follow My Website - https://sites.google.com/view/aj-blogs/home

Post a Comment

Previous Post Next Post
Best Programming Books

Facebook

AJ Facebook
Checkout Our Facebook Page
AJ Blogs
Checkout Our Instagram Page