Skip to content

Commit e04ea89

Browse files
committed
Flattened list
1 parent b2314f4 commit e04ea89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ sum_of_elements = sum(<list>)
3737
elementwise_sum = [sum(pair) for pair in zip(list_a, list_b)]
3838
sorted_by_second = sorted(<list>, key=lambda el: el[1])
3939
sorted_by_both = sorted(<list>, key=lambda el: (el[1], el[0]))
40-
flattened_list = [item for sublist in <list> for item in sublist]
40+
flattened_list = list(itertools.chain.from_iterable(<list>))
4141
list_of_chars = list(<str>)
4242
product_of_elems = functools.reduce(lambda out, x: out * x, <list>)
4343
```

0 commit comments

Comments
 (0)