Skip to content

Commit aefab0b

Browse files
author
boraxpr
committed
bite 74
1 parent 92b2c86 commit aefab0b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

74/bday.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import calendar
2+
from datetime import date
3+
4+
5+
def weekday_of_birth_date(date):
6+
"""Takes a date object and returns the corresponding weekday string"""
7+
d = date.weekday()
8+
return calendar.day_name[d]
9+
10+
11+
12+
# dt = date(1968, 9, 25)
13+
# print(weekday_of_birth_date(dt))
14+

74/test_bday.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from datetime import date
2+
3+
from bday import weekday_of_birth_date
4+
5+
6+
def test_leonardo_dicaprio_bday():
7+
dt = date(1974, 11, 11)
8+
assert weekday_of_birth_date(dt) == 'Monday'
9+
10+
11+
def test_will_smith_bday():
12+
dt = date(1968, 9, 25)
13+
assert weekday_of_birth_date(dt) == 'Wednesday'
14+
15+
16+
def test_robert_downey_bday():
17+
dt = date(1965, 4, 4)
18+
assert weekday_of_birth_date(dt) == 'Sunday'

0 commit comments

Comments
 (0)