+ 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))

4th Oct 2022, 6:10 PM
Vanessa Munteanu
Vanessa Munteanu - avatar
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
4th Oct 2022, 6:52 PM
Jayakrishna 🇮🇳