Report Bug

Qus

What will be the output of the following Python code snippet?

>>bool(False)
>>bool()
Qus

निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?

>>>bool(False)
>>>bool()


A. True True
B. False True
C. False False
D. True False


Solution
D. True False



Explanation
The Boolean function returns true if the argument passed to the bool function does not amount to zero. In the first example, the string ‘False’ is passed to the function bool. This does not amount to zero and hence the output is true. In the second function, an empty list is passed to the function bool. Hence the output is false.
Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad