+ 1
Why the output of this code is false true?
My_list=[([]),[()]] For i in My_list: Print (bool(i),end=" ")
1 ответ
+ 2
The items in the list are [] and [()]. An empty list evaluates to False, a non-empty list to True (even if it contains only one element which evaluates to False). Note that ([]) is the same as []. If you want it to be a tuple with one element, use ([],) instead. ([],) would evaluate to True (non-empty tuple).