Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 428 Bytes

66.md

File metadata and controls

21 lines (15 loc) · 428 Bytes
@author jackzhenguo
@desc 
@date 2019/4/6

66 求更长的列表

def max_length(*lst):
    return max(*lst, key=lambda v: len(v))


r = max_length([1, 2, 3], [4, 5, 6, 7], [8])
print(f'更长的列表是{r}')  # [4, 5, 6, 7]

r = max_length([1, 2, 3], [4, 5, 6, 7], [8, 9])
print(f'更长的列表是{r}')  # [4, 5, 6, 7]
[上一个例子](65.md) [下一个例子](67.md)