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!