Python · Question 9 · Medium
What will be the output of the following Python code?
print(bool("False"), bool(0.0), bool([0]))
- True False True
- False False False
- False False True
- True False False
Answer and explanation
Answer: A. True False True
Explanation: Any non-empty string is truthy, even "False". 0.0 is falsy. [0] is a non-empty list, so it is truthy even though its only element is 0.
Previous: What will be the output of the following Python code? · Next: What will be the output of the following Python code?
Practise python
Try a fresh set of python questions with an explanation after every answer, free and without signing up: Python practice. Or sit a full placement mock test.
More python questions
- What will be the output of the following Python code?
- What will be the output of the following Python code?
- What will be the output of the following Python code?
- What will be the output of the following Python code?
- What will be the output of the following Python code?
- What will be the output of the following Python code?
- What will be the output of the following Python code?
- What will be the output of the following Python code?
- What will be the output of the following Python code?
- What will be the output of the following Python code?
More technical & programming practice
Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge