Skip to content

Instantly share code, notes, and snippets.

@sharuzzaman
Created March 27, 2018 07:37
Show Gist options
  • Save sharuzzaman/550bede3e6d1af4024d94db5f51d41a3 to your computer and use it in GitHub Desktop.
Save sharuzzaman/550bede3e6d1af4024d94db5f51d41a3 to your computer and use it in GitHub Desktop.
total number of sunday in a month
#!/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