-2

I want to check what is the biggest string in a list

Is there any function for this? for example:

lis = ['rafa', 'now', 'lucky']

And it returns 'lucky' or 5

peterh
  • 11,875
  • 18
  • 85
  • 108
rafa_rrayes
  • 155
  • 9

1 Answers1

3

You can try this:

 max(lis, key=len)

output:

'lucky'

answered by Paolo Bergantino here

Gonzalo Garcia
  • 6,192
  • 2
  • 29
  • 32