Fill in the blanks to extract all items that are less than 5 from the list. nums = [1, 2, 5, 8, 3, 0, 7] res = list( filter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 5

Fill in the blanks to extract all items that are less than 5 from the list. nums = [1, 2, 5, 8, 3, 0, 7] res = list( filter

help

8th Nov 2020, 11:22 AM
Jack Bradshaw
Jack Bradshaw - avatar
4 Answers
+ 11
Jack Bradshaw , this is one of the quizzes for filter() function. Just go back one step and read the description how this filter function is working. If you struggle by using the lambda, you can also see how this works.
8th Nov 2020, 12:11 PM
Lothar
Lothar - avatar
+ 4
Jack Bradshaw , if I may offer a suggestion, I think you may be trying to learn too fast. I would start over at the beginning of the lessons and work your way through them slowly. Take your time. Practice writing your own codes for every new concept. If anything doesn't make sense, see if you can find help in the lesson comments. Use Google a lot. It helps to see each new concept from several different viewpoints, so I suggest looking them up in a few tutorials, for example, https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming https://www.learnpython.org https://docs.python.org/3.8/tutorial/ It's a slower process but it's worth it because the knowledge you get will stick. If you're still stuck, then ask for help. The folks here love to help 😊 Good luck!
8th Nov 2020, 12:30 PM
David Ashton
David Ashton - avatar
+ 2
nums = [1, 2, 5, 8, 3, 0, 7] res = list( filter (lambda x: x < 5, nums)) print(res)
23rd Mar 2021, 10:16 AM
GetKet
GetKet - avatar
0
That is good
21st Feb 2024, 12:41 PM
Dawit Mengesha Beriso
Dawit Mengesha Beriso - avatar