Created
March 27, 2018 07:37
-
-
Save sharuzzaman/550bede3e6d1af4024d94db5f51d41a3 to your computer and use it in GitHub Desktop.
total number of sunday in a month
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
import calendar | |
import datetime | |
now = datetime.datetime.now() | |
cal = calendar.Calendar() | |
total_sunday = len([x for x in cal.itermonthdays2(now.year, now.month) if x[0] != 0 and x[1] == 6]) | |
print "Total Sunday this month: " + str(total_sunday) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment