finding a longest list within the lists in python
问题 I'm just a new in python and I need to print the lists which has minimum and maximum items in a list. For example if i have: total_list = [[1, 2, 3], [1, 2, 3, 4], [1,2,3,4,5]] I need to return a list with a minimum and maximum length of itself. How can I do it simply in python way? I try to iterate over it but all I could receive is the only len of each item in a list Output must be: total_list[0] and total_list[2] Thanks in advance 回答1: max and min function in python accepts a key argument