File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
# Python program to Find day of
2
2
# the week for a given date
3
- import calendar
4
- import datetime
3
+ import calendar #module of python to provide useful fucntions related to calendar
4
+ import datetime # module of python to get the date and time
5
5
6
6
7
7
def findDay (date ):
8
- born = datetime .datetime .strptime (date , '%d %m %Y' ).weekday ()
9
- return (calendar .day_name [born ])
8
+ born = datetime .datetime .strptime (date , '%d %m %Y' ).weekday () #this statement returns an integer corresponding to the day of the week
9
+ return (calendar .day_name [born ]) #this statement returns the corresponding day name to the integer generated in the previous statement
10
10
11
11
12
12
# Driver program
13
- date = '03 02 2019'
14
- print (findDay (date ))
13
+ date = '03 02 2019' #this is the input date
14
+ print (findDay (date )) # here we print the final output after calling the fucntion findday
You can’t perform that action at this time.
0 commit comments