how to make a person: tests and solution
tests
the code from person/tests/test_person.py from how to make a person
solution
the solution in person/src/person.py from how to make a person
1import datetime
2
3
4def say_hello(a_dictionary):
5 return (
6 f'Hi, my name is {a_dictionary.get("first_name")}'
7 f' {a_dictionary.get("last_name")} '
8 f'and I am {a_dictionary.get("age")}'
9 )
10
11
12def factory(
13 first_name, year_of_birth,
14 last_name='doe', sex='M',
15 ):
16 return {
17 'first_name': first_name,
18 'last_name': last_name,
19 'sex': sex,
20 'age': (
21 datetime.datetime.today().year
22 -year_of_birth
23 )
24 }