pytthon how many fridays c2 b4 between two dates

Solutions on MaxInterview for pytthon how many fridays c2 b4 between two dates by the best coders in the world

showing results for - "pytthon how many fridays c2 b4 between two dates"
Jessica
21 Mar 2017
1from datetime import  date
2
3d1 = date(2017, 1, 4)
4d2 = date(2017, 1, 31)
5
6count = 0
7
8for d_ord in range(d1.toordinal(), d2.toordinal()):
9    d = date.fromordinal(d_ord)
10    if (d.weekday() == 4):
11        count += 1
12
13print(count)