+ 1
What is this?
txt = input() problem = max(txt.split(), key=len) print(problem ) What is "key=len"?
1 Respuesta
+ 2
max() function in python takes three arguments.
1. The Iterable (String, list, tuple...)
2. The default value
3. The key
Now in your example:
The Iterable is a list of strings
And the key defines the function that is applied to each item in the Iterable
so here len() is the function used
and now each item is compared on the basis of length
ex:
input : some random string
output : random