Travis build: 147

This commit is contained in:
30secondsofcode
2019-10-08 06:55:33 +00:00
parent afa8f07720
commit a84088a3a0
3 changed files with 58 additions and 0 deletions

View File

@ -64,6 +64,7 @@
* [`symmetric_difference`](#symmetric_difference) * [`symmetric_difference`](#symmetric_difference)
* [`symmetric_difference_by`](#symmetric_difference_by) * [`symmetric_difference_by`](#symmetric_difference_by)
* [`tail`](#tail) * [`tail`](#tail)
* [`transpose`](#transpose)
* [`union`](#union) * [`union`](#union)
* [`union_by`](#union_by) * [`union_by`](#union_by)
* [`unique_elements`](#unique_elements) * [`unique_elements`](#unique_elements)
@ -1053,6 +1054,28 @@ tail([1]); # [1]
<br>[⬆ Back to top](#contents) <br>[⬆ Back to top](#contents)
### transpose
Returns the transpose of a two-dimensional list.
Use `*lst` to get the passed list as tuples.
Use `zip()` in combination with `list()` to create the transpose of the given two-dimensional list.
```py
def transpose(lst):
return list(zip(*lst))
```
<details>
<summary>Examples</summary>
```py
transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) # [(1, 4, 7, 10), (2, 5, 8, 11), (3, 6, 9, 12)]
```
</details>
<br>[⬆ Back to top](#contents)
### union ### union
Returns every element that exists in any of the two lists once. Returns every element that exists in any of the two lists once.

View File

@ -1086,6 +1086,21 @@
"hash": "f06acf219bcdfbacb9e86b01f91c7d68f6f8fa8a5a043c37cf33de4969c62eae" "hash": "f06acf219bcdfbacb9e86b01f91c7d68f6f8fa8a5a043c37cf33de4969c62eae"
} }
}, },
{
"id": "transpose",
"type": "snippetListing",
"title": "transpose",
"attributes": {
"text": "Returns the transpose of a two-dimensional list.\n\nUse `*lst` to get the passed list as tuples.\nUse `zip()` in combination with `list()` to create the transpose of the given two-dimensional list.\n\n",
"tags": [
"list",
"intermediate"
]
},
"meta": {
"hash": "e5768f5c6d605587cf01697dd8e06c5dc7c91e60818871691730600c6fba4ec6"
}
},
{ {
"id": "union", "id": "union",
"type": "snippetListing", "type": "snippetListing",

View File

@ -1436,6 +1436,26 @@
"hash": "f06acf219bcdfbacb9e86b01f91c7d68f6f8fa8a5a043c37cf33de4969c62eae" "hash": "f06acf219bcdfbacb9e86b01f91c7d68f6f8fa8a5a043c37cf33de4969c62eae"
} }
}, },
{
"id": "transpose",
"title": "transpose",
"type": "snippet",
"attributes": {
"fileName": "transpose.md",
"text": "Returns the transpose of a two-dimensional list.\n\nUse `*lst` to get the passed list as tuples.\nUse `zip()` in combination with `list()` to create the transpose of the given two-dimensional list.\n\n",
"codeBlocks": {
"code": "def transpose(lst):\n return list(zip(*lst))",
"example": "transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]) # [(1, 4, 7, 10), (2, 5, 8, 11), (3, 6, 9, 12)]"
},
"tags": [
"list",
"intermediate"
]
},
"meta": {
"hash": "e5768f5c6d605587cf01697dd8e06c5dc7c91e60818871691730600c6fba4ec6"
}
},
{ {
"id": "union", "id": "union",
"title": "union", "title": "union",