We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Date and Time
- Calendar Module
- Discussions
Calendar Module
Calendar Module
Sort by
recency
|
686 Discussions
|
Please Login in order to post a comment
Maybe my solution could inspire someone :
I have noticed with print() that weekday() return a number corresponding to the day in a week. (Monday = 0, Tuesday = 1, Wednesday = 2 ... Sunday = 6).
So I have created a dictionnary and use it with the function calendar.weekday() to return the good day name :
arr = input().split()
month = int(arr[0]) date = int(arr[1]) year = int(arr[2])
weeddayidx = calendar.weekday(year, month, date) print(calendar.day_name[weeddayidx].upper())