Python Function to Display Calendar

Python Function to Display Calendar

In this tutorial, we will learn how to display the calendar of any month of any year using Python.

In the code below, we will import the “calendar” module. It has an inbuilt “month()” function, which takes the year and month of which the user wants to display the calendar.

Example:

Output:

Case -1

Please enter the Year:  1919
Please enter the month:  01
The Calendar of:      January 1919
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

Case -2

Please enter the Year:  2022
Please enter the month:  10
The Calendar of:      October 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

Conclusion

In this tutorial, we have discussed how a user can display the calendar in Python.


原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/263280.html

(0)
上一篇 2022年5月30日
下一篇 2022年5月30日

相关推荐

发表回复

登录后才能评论