Python program to print calendars; In this tutorial, you will learn how to print or display calendars in the python program.
Python Program to Display Calendar
- Python program to print the calendar of a given month and year
- Python program to print calendar of any year
Python program to print the calendar of a given month and year
Follow the following steps and write python program to print the calendar of a given month and year:
- Take input year/month from the user.
- After that, call the month function.
- Print the calendar of given month and year.
# Python program to print Calendar using # Python Calender module import calendar # take year from user year = int(input("Enter Year: ")) # take month from user month = int(input("Enter Month: ")) # printing Calendar print(calendar.month(year, month))
Output
Enter Year: 2020 Enter Month: 04 April 2020 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
Python program to print calendar of any year
Follow the following steps and write python program to print the whole year calendar:
- Take input year from the user.
- Set the day of calendar.
- After that, call the year function.
- Print the calendar of the given year.
# Python program to print Calendar using # Python Calender module import calendar # take year from user year = int(input("Enter Year: ")) cal = calendar.TextCalendar(calendar.MONDAY) # year: 2022, column width: 2, lines per week: 1 # number of spaces between month columns: 1 # 3: no. of months per column. print(cal.formatyear(year, 2, 1, 1, 3))
Output
Enter Year: 2020 2020 January February March Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 5 1 2 1 6 7 8 9 10 11 12 3 4 5 6 7 8 9 2 3 4 5 6 7 8 13 14 15 16 17 18 19 10 11 12 13 14 15 16 9 10 11 12 13 14 15 20 21 22 23 24 25 26 17 18 19 20 21 22 23 16 17 18 19 20 21 22 27 28 29 30 31 24 25 26 27 28 29 23 24 25 26 27 28 29 30 31 April May June Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 5 1 2 3 1 2 3 4 5 6 7 6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14 13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21 20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28 27 28 29 30 25 26 27 28 29 30 31 29 30 July August September Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 5 1 2 1 2 3 4 5 6 6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13 13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20 20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27 27 28 29 30 31 24 25 26 27 28 29 30 28 29 30 31 October November December Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 1 1 2 3 4 5 6 5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13 12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20 19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27 26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31 30
Recommended Python Programs
- Python Program to Find/Calculate Average of 3, 4, 5…n numbers
- Python Program to Print ASCII Value of Character
- Write a Program to Calculate Simple Interest in Python
- Python Program to Compute Compound Interest
- Leap Year Program in Python
- Python Program to Print Star Pattern
- Number Pattern Programs in Python
- Python Program to Print Even and Odd numbers From 1 to N
- Python Abs() Function: For Absolute Value
- How to Check Whether a Number is Fibonacci or Not in Python
- Python: Program to Find Power of Number
- Python Program to Reverse a Numbers
- Python Program to Find Smallest/Minimum of n Numbers
- Python Program to Find Largest/Maximum of n Numbers
- Python Program to Find The Net Bill Amount After Discount
- Python Program to Print Numbers From N to 1 and 1 to N
- Python Program to Print Numbers Divisible by 3, 5, 7
- Python Program to Print Prime Number 1 to N
- How to Find Square of Number in Python
- Python Program to Calculate Cube of Number
- Python Program to Find LCM of Two Numbers
- BMI (Body Mass Index) Calculator in Python
- Palindrome Program in Python using while loop, Function, etc
- Python: Program to Count Total Number of Bits in Number
- Python Random Number Generator Code
- Python Program to Calculate n-th term of a Fibonacci Series
- Zip Zap Zoom Python Program
- Python: program to convert Celsius to Fahrenheit
- Python Program to Swap Two Numbers
- Python Program to Get Standard Deviation
- Python Program to Find the Variance
- Python Program to Convert Height in cm to Feet and Inches
- Python Program to Convert Meters into Yards, Yards into Meters
- Python Program to Convert Kilometers to Meters, Miles
- Python Program to Find Perfect Number
- Python: Program to Find Strong Number
- Python Program Create Basic Calculator
- Python Program For math.floor() Method
- Python Program to Print Alphabets from A to Z in Uppercase and Lowercase
- Python Program to Check Given Input is Alphabet, Number or Special Character
- Python Program to Check IF a Number is Power of Another Number
- Python Check Binary Representation of Given Number is Palindrome or Not
- Python Program to Draw a Pie Chart
- Python Program Input the Radius of Circle and Compute the Area
- Python Program to Calculate the Area of a Rectangle
- Python Program to Calculate Area of Triangle
- Python Program to Find Area and Circumference of Circle using Radius
- Python Program that Accepts Marks in 5 Subjects and Outputs Average Marks
- Python Program to Print Binary Value of Numbers From 1 to N