🧠 Python MCQ Question
❓ What is the output of the following code? >>print(bool("False"))
❓ What is the output of the following code? >>print(bool("False"))
Anonymous Poll
37%
True
43%
False
17%
Error
3%
None
✅ Correct Answer: A) True
📘 Explanation:
The bool() function in Python returns False only for:
Empty strings ""
The number 0
Empty containers ([], {}, set())
None
"False" (with quotes) is a non-empty string, so it is truthy.
Therefore, bool("False") returns True.
React ❤️ if you got it right
📘 Explanation:
The bool() function in Python returns False only for:
Empty strings ""
The number 0
Empty containers ([], {}, set())
None
"False" (with quotes) is a non-empty string, so it is truthy.
Therefore, bool("False") returns True.
React ❤️ if you got it right
🧠 Python MCQ Question
❓ What is the output of the following code? >>print(3 * "abc")
❓ What is the output of the following code? >>print(3 * "abc")
Anonymous Poll
64%
abcabcabc
9%
abc*3
5%
Error
21%
abc abc abc
✅ Correct Answer: A) abcabcabc
📘 Explanation:
In Python, multiplying a string by an integer repeats the string that many times.
So, 3 * "abc" is the same as "abc" + "abc" + "abc", which gives:
→ "abcabcabc"
React ❤️ if you got it right
📘 Explanation:
In Python, multiplying a string by an integer repeats the string that many times.
So, 3 * "abc" is the same as "abc" + "abc" + "abc", which gives:
→ "abcabcabc"
React ❤️ if you got it right