Skip to content

Commit f4cb507

Browse files
committed
Update print_family_tree to print descendants recursively
1 parent 83804ee commit f4cb507

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

prep_exercise/6_generics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Person:
1313
imran = Person(name="Imran", age = 33, children=[fatma, aisha])
1414

1515
def print_family_tree(person: Person) -> None:
16-
print(person.name)
16+
print(f"- {person.name} ({person.age})")
1717
for child in person.children:
18-
print(f"- {child.name} ({child.age})")
18+
print_family_tree(child)
1919

2020
print_family_tree(imran)

0 commit comments

Comments
 (0)