Update longest_item.md
This commit is contained in:
@ -2,13 +2,13 @@
|
||||
title: longest_item
|
||||
tags: list,string,intermediate
|
||||
firstSeen: 2019-08-20T15:27:49+03:00
|
||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||
lastUpdated: 2021-10-17T18:24:43+02:00
|
||||
---
|
||||
|
||||
Takes any number of iterable objects or objects with a length property and returns the longest one.
|
||||
|
||||
- Use `max()` with `len()` as the `key` to return the item with the greatest length.
|
||||
- If multiple objects have the same length, the first one will be returned.
|
||||
- If multiple items have the same length, the first one will be returned.
|
||||
|
||||
```py
|
||||
def longest_item(*args):
|
||||
|
||||
Reference in New Issue
Block a user