How to write Calendar program in python
The built-in calendar module in Python makes it very easy to create a calendar software. This is a basic example that uses user input to display a monthly calendar:
Basic Calendar Program in Python:
import calendar # Ask the user for year and month year = int(input("Enter year (e.g., 2025): ")) month = int(input("Enter month (1-12): ")) # Display the calendar print("\nHere is your calendar:\n") print(calendar.month(year, month))
Result :
PS C:\Users\sachi\Python-top-program> & C:/Users/sachi/AppData/Local/Microsoft/WindowsApps/python3.13.exe c:/Users/sachi/Python-top-program/Calender.py
Enter year (e.g., 2025): 2025
Enter month (1-12): 2
Here is your calendar:
February 2025
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
PS C:\Users\sachi\Python-top-program>
import calendar yy = 2024 #year mm = 10 #month #display the calendar print(calendar.month(yy,mm))
Result:
PS C:\Users\sachi\Python-top-program> & C:/Users/sachi/AppData/Local/Microsoft/WindowsApps/python3.13.exe c:/Users/sachi/Python-top-program/Calender.py
October 2024
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
PS C:\Users\sachi\Python-top-program>
Calendar.Py.
Display Calendar in Python: Python Program to Display Calendar
Comet AI Browser by Perplexity.ai: The New AI-Powered Browser