Bird
0
0

Consider this code:

medium📝 Predict Output Q4 of 15
Python - Modules and Code Organization
Consider this code:
import sys
print(type(sys.path))

What will be the output?
A<class 'list'>
B<class 'str'>
C<class 'tuple'>
DAn error will be raised
Step-by-Step Solution
Solution:
  1. Step 1: Identify sys.path type

    sys.path is a list object containing directory strings.
  2. Step 2: Check output of type()

    Calling type(sys.path) returns the class type of the object, which is list.
  3. Final Answer:

    <class 'list'> -> Option A
  4. Quick Check:

    sys.path is always a list [OK]
Quick Trick: sys.path is a list object [OK]
Common Mistakes:
  • Assuming sys.path is a string or tuple
  • Expecting an error from type() call
  • Confusing sys.path with sys.modules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes