From cea06ea3be75eef99a470e7e12823173fd3354cf Mon Sep 17 00:00:00 2001 From: Alvin Ryanputra Date: Mon, 18 Nov 2024 10:34:55 -0500 Subject: [PATCH] Some sample function --- common_tags.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common_tags.py diff --git a/common_tags.py b/common_tags.py new file mode 100644 index 0000000..da631f8 --- /dev/null +++ b/common_tags.py @@ -0,0 +1,11 @@ +from __future__ import annotations + + +def find_common_tags(articles: list[dict[str, list[str]]]) -> set[str]: + if not articles: + return set() + + common_tags = articles[0]["tags"] + for article in articles[1:]: + common_tags = [tag for tag in common_tags if tag in article["tags"]] + return set(common_tags) \ No newline at end of file