QuestionQ74

Modules and Packages

What is the expected output of this code?

import sys  
import math  
b1 = type(dir(math)) is list  
b2 = type(sys.path) is list  
print(b1 and b2)  
  • A None
  • B True
  • C 0
  • D False
Explanation

dir() returns a list, and sys.path is a list. Both identity checks therefore evaluate to True, so b1 and b2 prints True.

Community Discussion

No comments yet. Be the first to start the discussion!