Where’s the mistake? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Where’s the mistake?

Trying to complete the practice but while submitting system says there’s invalid syntax in the 7th line (print). But I don’t understand what’s the mistake. Could you help me please? names = ["David", "John", "Annabelle", "Johnathan", "Veronica"] #your code goes here long_name = list(filter(lambda x:len(x)> 5, names) print(long_name)

27th Dec 2022, 11:13 PM
Valeria
Valeria - avatar
5 Answers
+ 5
You forgot a parenthese to close your list() function
27th Dec 2022, 11:22 PM
Vanessa Nilsson
+ 2
np!
27th Dec 2022, 11:45 PM
Vanessa Nilsson
+ 1
Isak Nilsson, thank you very much!:)
27th Dec 2022, 11:44 PM
Valeria
Valeria - avatar
+ 1
Faster code execution using List Comprehension Approach names = ["David", "John", "Annabelle", "Johnathan", "Veronica"] long_name = [i for i in names if len(i) > 5] print(long_name)
28th Dec 2022, 5:04 PM
iTech
iTech - avatar
0
iTech, yes, thank you for the suggestion:) In this practice they wanted for user to practice filters and lambdas
28th Dec 2022, 8:34 PM
Valeria
Valeria - avatar