18 questions • Select the best answer for each question
What is the Boolean data type in Python?
Which are valid Boolean values in Python?
What is the output? print(5 > 3)
What does == do in Python?
What is the output? print(10 == 10)
Which condition will evaluate to False?
Which of the following is a Falsy value?
What is the output? print(bool([]))
What does this print? print(bool([1, 2, 3]))
How do you check if a list is empty?
What will this print? items = [1, "apple", 3.5] for item in items: print(type(item))
What does this code check? data = [1, 2, [3, 4]] for item in data: if type(item) == list: print("Nested list found")
What will be printed? data = [1, [2, 3], 4] for item in data: if type(item) == list: print(len(item))
What does this code do? data = [1, [2, 3], 4] for item in data: if type(item) == list: for x in item: print(x)
Which value is Truthy?
What is the output? if [1, 2]: print("Yes") else: print("No")
Why are Booleans important in real programs?
Which statement is TRUE?