mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Update python3.html.markdown
The same happens for `filter`. ```pythob filter(lambda x: x > 5, [3, 4, 5, 6, 7]) <filter at 0x110567320> list(filter(lambda x: x > 5, [3, 4, 5, 6, 7])) [6, 7] ```
This commit is contained in:
parent
9dca295c05
commit
6248cd1f84
@ -592,7 +592,7 @@ add_10(3) # => 13
|
|||||||
list(map(add_10, [1, 2, 3])) # => [11, 12, 13]
|
list(map(add_10, [1, 2, 3])) # => [11, 12, 13]
|
||||||
list(map(max, [1, 2, 3], [4, 2, 1])) # => [4, 2, 3]
|
list(map(max, [1, 2, 3], [4, 2, 1])) # => [4, 2, 3]
|
||||||
|
|
||||||
filter(lambda x: x > 5, [3, 4, 5, 6, 7]) # => [6, 7]
|
list(filter(lambda x: x > 5, [3, 4, 5, 6, 7])) # => [6, 7]
|
||||||
|
|
||||||
# We can use list comprehensions for nice maps and filters
|
# We can use list comprehensions for nice maps and filters
|
||||||
# List comprehension stores the output as a list which can itself be a nested list
|
# List comprehension stores the output as a list which can itself be a nested list
|
||||||
|
Loading…
Reference in New Issue
Block a user