The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #124
bool([[]])
The __bool__() method of lists returns True when the list is not empty, and False when the list is empty. Here, the outer list is not empty has it contains another (empty) list. As such, bool([[]]) returns True . (tutorialspoint.com/How-to-check-if-a-list-is-empty-in-Python)
What is the output of this code snippet?
— The Python Quiz (@thepythonquiz) July 15, 2020
bool([[]])
False
True#python #python3 #pythonprogramming #learnpython
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: