Travis build: 115
This commit is contained in:
@ -800,11 +800,11 @@ min_n([1, 2, 3], 2) # [1,2]
|
||||
|
||||
Returns `False` if the provided function returns `True` for at least one element in the list, `True` otherwise.
|
||||
|
||||
Use `all()` in combination with `map()` and `fn` to check if `fn` returns `False` for all the elements in the list.
|
||||
Use `all()` and `fn` to check if `fn` returns `False` for all the elements in the list.
|
||||
|
||||
```py
|
||||
def none(lst, fn=lambda x: x):
|
||||
return all(map(lambda x: not fn(x), lst))
|
||||
return all(not fn(x) for x in lst)
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
@ -844,7 +844,7 @@
|
||||
"type": "snippetListing",
|
||||
"title": "none",
|
||||
"attributes": {
|
||||
"text": "Returns `False` if the provided function returns `True` for at least one element in the list, `True` otherwise.\n\nUse `all()` in combination with `map()` and `fn` to check if `fn` returns `False` for all the elements in the list.\n\n",
|
||||
"text": "Returns `False` if the provided function returns `True` for at least one element in the list, `True` otherwise.\n\nUse `all()` and `fn` to check if `fn` returns `False` for all the elements in the list.\n\n",
|
||||
"tags": [
|
||||
"list",
|
||||
"function",
|
||||
@ -852,7 +852,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "5d0682964ee65801c79ed3f165c5c699d61176928fb5bb59e0b02717293b5253"
|
||||
"hash": "0dd3614b71e7a0b646a084e991eb6b4b2940492a14e6b8159d5d8a60a5abe04d"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -1115,9 +1115,9 @@
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "none.md",
|
||||
"text": "Returns `False` if the provided function returns `True` for at least one element in the list, `True` otherwise.\n\nUse `all()` in combination with `map()` and `fn` to check if `fn` returns `False` for all the elements in the list.\n\n",
|
||||
"text": "Returns `False` if the provided function returns `True` for at least one element in the list, `True` otherwise.\n\nUse `all()` and `fn` to check if `fn` returns `False` for all the elements in the list.\n\n",
|
||||
"codeBlocks": {
|
||||
"code": "def none(lst, fn=lambda x: x):\n return all(map(lambda x: not fn(x), lst))",
|
||||
"code": "def none(lst, fn=lambda x: x):\n return all(not fn(x) for x in lst)",
|
||||
"example": "none([0, 1, 2, 0], lambda x: x >= 2 ) # False\nnone([0, 0, 0]) # True"
|
||||
},
|
||||
"tags": [
|
||||
@ -1127,7 +1127,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "5d0682964ee65801c79ed3f165c5c699d61176928fb5bb59e0b02717293b5253"
|
||||
"hash": "0dd3614b71e7a0b646a084e991eb6b4b2940492a14e6b8159d5d8a60a5abe04d"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user