From 05aeeda3dd200f83d0ac73697780fe75cc90590d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Fri, 28 Dec 2018 04:03:19 +0100 Subject: [PATCH] Fixed last commit --- README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d497b4a..a0e88ff 100644 --- a/README.md +++ b/README.md @@ -33,15 +33,14 @@ List ``` ```python -sum_of_elements = sum() -elementwise_sum = [sum(pair) for pair in zip(list_a, list_b)] -sorted_by_second = sorted(, key=lambda el: el[1]) -sorted_by_both = sorted(, key=lambda el: (el[1], el[0])) -flattened_list = list(itertools.chain.from_iterable()) -list_of_chars = list() -product_of_elems = functools.reduce(lambda out, x: out * x, ) -no_duplicates = list(set()) # Does not preserve order -no_duplicates_ordered = list(dict.fromkeys()) # Preserves order +sum_of_elements = sum() +elementwise_sum = [sum(pair) for pair in zip(list_a, list_b)] +sorted_by_second = sorted(, key=lambda el: el[1]) +sorted_by_both = sorted(, key=lambda el: (el[1], el[0])) +flattened_list = list(itertools.chain.from_iterable()) +list_of_chars = list() +product_of_elems = functools.reduce(lambda out, x: out * x, ) +no_duplicates = list(dict.fromkeys()) ``` ```python @@ -67,7 +66,6 @@ Dictionary ```python collections.defaultdict() # Creates a dictionary with default value of type. collections.defaultdict(lambda: 1) # Creates a dictionary with default value 1. -collections.OrderedDict() # Creates ordered dictionary. ``` ```python