All quizzesEasy
Core Concepts
Preview — 3 of 10 questions
What is the output of the following code?
javascript
print(type(True))
print(isinstance(True, int))
print(True + True)
print(True == 1)A<class 'bool'>, True, 1, False
B<class 'bool'>, False, 2, True
C<class 'bool'>, True, 2, True
D<class 'boolean'>, True, 2, True
What will the following code print?
javascript
def append_item(item, target=[]):
target.append(item)
return target
print(append_item(1))
print(append_item(2))A[1] then [1, 2]
B[1] then [2]
C[1, 2] then [1, 2]
DTypeError
What is the output of the following code?
javascript
values = [0, "", [], {}, None, False, "0", " ", [0]]
print([bool(v) for v in values])A[False, False, False, False, False, False, True, False, True]
B[False, False, False, False, False, False, True, True, True]
C[False, True, False, True, False, False, True, True, True]
D[False, False, False, False, False, False, False, True, True]
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.