+ 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 Answer
+ 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
Hot today
BMI calculator code project
0 Votes
SQL
1 Votes
Paint Costs
1 Votes
How to create a border
0 Votes
Overloading + operator
0 Votes