-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
  • 1
  • 15
  • 76
  • 99
rafa_rrayes
  • 155
  • 8

1 Answers1

3

You can try this:

 max(lis, key=len)

output:

'lucky'

answered by Paolo Bergantino here

Gonzalo Garcia
  • 5,208
  • 2
  • 25
  • 31