Table of Contents

, , , , , , , , ,

About the Club

Python Club Topics - Exercise: Display calendar

Exercise: Display a calendar month

  1. Output: Display the calendar month for the given month and year
  2. What you learn from the example:
    1. Importing and using library modules
    2. Using the calendar module
    3. Passing arguments to modules
    4. Take input from the user

Solution

[1] code:python show
# Program to display calendar of the given month and year

# importing calendar module
import calendar

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