What is the output of the following Python code? print(bool(“False”), bool(“”), bool(0.0))
Correct answer A. True False False
Explanation
Any non-empty string is truthy, whatever its content, so bool("False") is True. The empty string and zero of any numeric type, including 0.0, are falsy. Converting user input such as "False" to a boolean therefore needs an explicit comparison, not bool().
Answer checked How we write and check questions
Discussion