Travis build: 191
This commit is contained in:
23
README.md
23
README.md
@ -52,6 +52,7 @@
|
|||||||
* [`intersection_by`](#intersection_by)
|
* [`intersection_by`](#intersection_by)
|
||||||
* [`last`](#last)
|
* [`last`](#last)
|
||||||
* [`longest_item`](#longest_item)
|
* [`longest_item`](#longest_item)
|
||||||
|
* [`max_element_index`](#max_element_index)
|
||||||
* [`max_n`](#max_n)
|
* [`max_n`](#max_n)
|
||||||
* [`min_n`](#min_n)
|
* [`min_n`](#min_n)
|
||||||
* [`most_frequent`](#most_frequent)
|
* [`most_frequent`](#most_frequent)
|
||||||
@ -774,6 +775,28 @@ longest_item([1, 2, 3], 'foobar') # 'foobar'
|
|||||||
|
|
||||||
<br>[⬆ Back to top](#contents)
|
<br>[⬆ Back to top](#contents)
|
||||||
|
|
||||||
|
### max_element_index
|
||||||
|
|
||||||
|
Returns the pindex of the element with the maximum value in a list.
|
||||||
|
|
||||||
|
Use `max()` and `list.index()` to get the maximum value in the list and return its index.
|
||||||
|
|
||||||
|
```py
|
||||||
|
def max_element_index(arr):
|
||||||
|
return arr.index(max(arr))
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Examples</summary>
|
||||||
|
|
||||||
|
```py
|
||||||
|
thon
|
||||||
|
max_element_index([5, 8, 9, 7, 10, 3, 0]) # 4
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<br>[⬆ Back to top](#contents)
|
||||||
|
|
||||||
### max_n
|
### max_n
|
||||||
|
|
||||||
Returns the `n` maximum elements from the provided list.
|
Returns the `n` maximum elements from the provided list.
|
||||||
|
|||||||
@ -788,6 +788,21 @@
|
|||||||
"hash": "aca578491d9c055c793cf782db88f7e0c1de093c3e9ad09a72a59e75055b7581"
|
"hash": "aca578491d9c055c793cf782db88f7e0c1de093c3e9ad09a72a59e75055b7581"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "max_element_index",
|
||||||
|
"type": "snippetListing",
|
||||||
|
"title": "max_element_index",
|
||||||
|
"attributes": {
|
||||||
|
"text": "Returns the pindex of the element with the maximum value in a list.\n\nUse `max()` and `list.index()` to get the maximum value in the list and return its index.\n\n",
|
||||||
|
"tags": [
|
||||||
|
"list",
|
||||||
|
"beginner"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"hash": "b482aa65907f5e1516d22e1e1ba88a87234a83e8db220a11e9ea4687cee6376c"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "max_n",
|
"id": "max_n",
|
||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
|
|||||||
@ -1043,6 +1043,26 @@
|
|||||||
"hash": "aca578491d9c055c793cf782db88f7e0c1de093c3e9ad09a72a59e75055b7581"
|
"hash": "aca578491d9c055c793cf782db88f7e0c1de093c3e9ad09a72a59e75055b7581"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "max_element_index",
|
||||||
|
"title": "max_element_index",
|
||||||
|
"type": "snippet",
|
||||||
|
"attributes": {
|
||||||
|
"fileName": "max_element_index.md",
|
||||||
|
"text": "Returns the pindex of the element with the maximum value in a list.\n\nUse `max()` and `list.index()` to get the maximum value in the list and return its index.\n\n",
|
||||||
|
"codeBlocks": {
|
||||||
|
"code": "def max_element_index(arr):\r\n return arr.index(max(arr))",
|
||||||
|
"example": "thon\r\nmax_element_index([5, 8, 9, 7, 10, 3, 0]) # 4"
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"list",
|
||||||
|
"beginner"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"hash": "b482aa65907f5e1516d22e1e1ba88a87234a83e8db220a11e9ea4687cee6376c"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "max_n",
|
"id": "max_n",
|
||||||
"title": "max_n",
|
"title": "max_n",
|
||||||
|
|||||||
Reference in New Issue
Block a user