Travis build: 133
This commit is contained in:
@ -558,14 +558,14 @@
|
||||
"type": "snippetListing",
|
||||
"title": "intersection",
|
||||
"attributes": {
|
||||
"text": "Returns a list of elements that exist in both lists.\n\nCreate a `set` from `b`, then use list comprehension on `a` to only keep values contained in both lists.\n\n",
|
||||
"text": "Returns a list of elements that exist in both lists.\n\nCreate a `set` from `a` and `b`, then use the built-in set operator `&` to only keep values contained in both sets, then transform the `set` back into a `list`.\n\n",
|
||||
"tags": [
|
||||
"list",
|
||||
"beginner"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "a332cce7b7d7e303469e8c39c4926bf92ecb12847c3932985cc633e3a85a23bb"
|
||||
"hash": "d20f757b18d4368324bfa74bb907f5dc2df9262886ea3722edd5015418ce282d"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -739,9 +739,9 @@
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "intersection.md",
|
||||
"text": "Returns a list of elements that exist in both lists.\n\nCreate a `set` from `b`, then use list comprehension on `a` to only keep values contained in both lists.\n\n",
|
||||
"text": "Returns a list of elements that exist in both lists.\n\nCreate a `set` from `a` and `b`, then use the built-in set operator `&` to only keep values contained in both sets, then transform the `set` back into a `list`.\n\n",
|
||||
"codeBlocks": {
|
||||
"code": "def intersection(a, b):\n _b = set(b)\n return [item for item in a if item in _b]",
|
||||
"code": "def intersection(a, b):\n _a, _b = set(a), set(b)\n return list(_a & _b)",
|
||||
"example": "intersection([1, 2, 3], [4, 3, 2]) # [2, 3]"
|
||||
},
|
||||
"tags": [
|
||||
@ -750,7 +750,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "a332cce7b7d7e303469e8c39c4926bf92ecb12847c3932985cc633e3a85a23bb"
|
||||
"hash": "d20f757b18d4368324bfa74bb907f5dc2df9262886ea3722edd5015418ce282d"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user