+ 2
Why is the outcome 25? I got this question in a challenge and don’t understand.
words = ["hi", "solo", "learn"] more = [x*len(x) for x in words] print(len(max(more,key=len))
1 Réponse
+ 7
List comprehension does :
more = [ "hi"*2, "Solo"*4, "Learn"*5 ]
max( ) finding max element depending on len(element)
so obviously it returns
"learn"*5 => "learnlearnlearnlearnlearn"
and which length is 25