What is the difference between filter() and takewhile()? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between filter() and takewhile()?

19th Aug 2016, 7:18 AM
Михайло «GhostKU» Осадчий
Михайло «GhostKU» Осадчий - avatar
1 Answer
+ 10
filter() gets ALL items of the list that match the predicate whereas takewhile() gets all items until an element occurs that doesn't match the predicate
24th Aug 2016, 7:57 PM
R4stafa