From 82d99f98cb0b59f2e767a132ac24b43a70ade92b Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Mon, 16 Mar 2020 22:00:46 +0200 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: Isabelle Viktoria Maciohsek --- snippets/is_contained_in.md | 6 ++++-- snippets/map_object.md | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/snippets/is_contained_in.md b/snippets/is_contained_in.md index 93550ddf9..1491bcb65 100644 --- a/snippets/is_contained_in.md +++ b/snippets/is_contained_in.md @@ -3,9 +3,11 @@ title: is_contained_in tags: list,intermediate --- -Returns `True` if the elements of the first λιστ are contained in the second one regardless of order, `False` otherwise. +Returns `True` if the elements of the first list are contained in the second one regardless of order, `False` otherwise. + + +Use `count()` to check if any value in `a` has more occurences than it has in `b`, returning `False` if any such value is found, `True` otherwise. -Use `count()` to check if any value in `a` has more occurences than it has in `b`, returing `False` if any such value is found, `True` otherwise. ```py def is_contained_in(a, b): diff --git a/snippets/map_object.md b/snippets/map_object.md index 5eebb5843..57eae334d 100644 --- a/snippets/map_object.md +++ b/snippets/map_object.md @@ -3,7 +3,8 @@ title: map_object tags: list,intermediate --- -Maps the values of a list to a dictionary using a function, where the key-value pairs consist of the value as the key and the mapped value. +Maps the values of a list to a dictionary using a function, where the key-value pairs consist of the original value as the key and the result of the function as the value. + Use a `for` loop to iterate over the list's values, assigning the values produced by `fn` to each key of the dictionary.