ProgrammingHardTCS NQT · Accenture
What is printed?
What is printed?
print(isinstance([], list) and isinstance((), tuple), type([]) == list)
- A. True True
- B. True False
- C. False True
- D. False False
Correct answer: A. True True
Both isinstance checks are True, and type([]) is the list class, so the comparison is True.
More Python Programming questions
- What is printed? python print(''.join(sorted('hello', key=lambda c: c in 'aeiou')))
- What is printed? python print(len({(1, 2): 'a', (2, 1): 'b', (1, 2): 'c'}))
- What is printed? python x = 5 def f(): return x x = 6 print(f(), (lambda: x)())
- What is printed? python print(list(range(10))[2:8:3], list(range(10))[::4])
- What is printed? python print(not [] is [], (not []) is [])
- What is printed? python print(sum(map(int, '1234')), '1234'[::-1] == '4321')