1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| from typing import List, TypedDict
class Author(TypedDict):
name: str
email: str
bio: str
website: str
class Post(TypeDict):
title: str
author: Author
publication_date: str
content: str
def get_authors_names(posts: List[Post]) -> List[str]:
return [post["author"]["name"] for post in posts]
|