0

Syntax related to "all"

what is the difference between below statement> if all([i > 5 for i in nums]): vs if ([i > 5 for i in nums]): vs if (i > 5 for i in nums):

27th Jul 2018, 7:15 AM
AMBATI LOKESH
AMBATI LOKESH - avatar
1 Answer
+ 5
first returns True if all elements > 5 second returns a list like [True, False, True], returns True if list is not empty third returns a generator, returns True
27th Jul 2018, 8:14 AM
Mert Yazıcı
Mert Yazıcı - avatar