What will be the output of the following Python code? [code]s={4>3, 0, 3-3} all(s) any(s)[/code]

What will be the output of the following Python code?
Code:
s={4>3, 0, 3-3}
all(s)
any(s)
A.
True
False
B.
False
True
C.
True
True
D.
False
False
 
Answer: b
Explanation: The function all returns true only if all the conditions given are true. But in the example shown above, we have 0 as a value. Hence false is returned. Similarly, any returns true if any one condition is true. Since the condition 4>3 is true, true is returned.
 

Tìm kiếm

Back
Top