diff --git a/README.md b/README.md index cde6cf9..b806c15 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,9 @@ List sum() sorted_by_second = sorted(, key=lambda el: el[1]) flattened_list = [item for sublist in for item in sublist] +list() # Creates list of chars. ``` -```python ->>> list('ABC') -['A', 'B', 'C'] -``` Dictionary ---------- @@ -43,17 +40,18 @@ Dictionary .update() ``` +```python +>>> a = [('x', 4), ('y', 5)] +>>> dict(a) +{'x': 4, 'y': 5} +``` + ```python collections.defaultdict() # Creates a dictionary with default values. dict(zip(keys, values)) # Initiates a dict from two lists. {k: v for k, v in .items() if k in } # Filters a dict by keys. ``` -```python ->>> a = [('x', 4), ('y', 5)] ->>> dict(a) -{'x': 4, 'y': 5} -``` ### Counter ```python