Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 357 Bytes

File metadata and controls

19 lines (14 loc) · 357 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]