0

function takewhile has same functioning as filter.so why use it?

8th Jul 2016, 4:58 PM
jayrajarora2694
jayrajarora2694 - avatar
1 Resposta
+ 1
Filter catches all elements of the iterable that satisfy the predicate, whereas takewhile stops at the first element that doesn't. e.g. if you add nums.append(5) before the last print statement in the example above the output stays the same.
8th Jul 2016, 11:37 PM
why do i have to sign up for everything