[Tutor] all( ) built in function
Manprit Singh
manpritsinghece at gmail.com
Wed Oct 14 13:26:49 EDT 2020
Dear Sir ,
I just want to check my understanding of using all( ), a built in
function, with examples given below :
test_seq = [ [2, 3], [3, 6], [ ], [4, 8] ]
all(test_seq) will return False as test_seq contains an empty list which is
considered as false object when tested for truth value
t_lst = [3, 5, 6, 0, 7]
all(t_lst) will also return False as t_lst contains a 0 which is
considered as a false object when tested for truth value.
test_s = [None, True, True, True]
all(test_s) will also return False as test_s contains None which is
considered as a false object when tested for truth value.
t_s = [3, 5, 8, 9]
all(t_s) will return True as every element of t_s is considered as a true
object when tested for truth value.
Your precious comments needed
Regards
Manprit Singh
Kindly let me know
More information about the Tutor
mailing list