How to Display Year Calendar in Python?

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

# 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))

Here is an another example to display year calendar

# importing the calendar module

import calendar

# initializing the year

year = 2023

# printing the calendar

print(calendar.calendar(year))

Try this on your own. If you have encounter any issue post screenshot in the comment.

Happy Coding!

--

--

Technical Writer ☝️| Design Engineer💻 | Solutions Architect 🏗️ | Visit at https://logicalidea.co/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rahul Sharma

Technical Writer ☝️| Design Engineer💻 | Solutions Architect 🏗️ | Visit at https://logicalidea.co/