Basic Programs

If Else Programs

While loop Programs

For loop Programs

List Programs


Python program to print the calendar of a given Month and Year


In this example shows, how to print the calendar of month and year using the calendar module of Python.

  • First, we import the calendar module.
  • The built-in function month() could display the calendar for given month and the year.
example.py
import calendar
year = 2022
month = 1
print(calendar.month(year, month))

Output

    January 2022
Mo Tu We Th Fr Sa Su
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

Prev Next