What is the role of the import statement in Python?
A. To declare variables
B. To define classes
C. To import external modules
D. To output text to the console
Answer: Option C
Solution (By Examveda Team)
In Python, the import statement is used to import external modules.The import statement allows you to access functionality defined in external modules and use it in your Python program. Modules are Python files that contain Python code, including variables, functions, and classes. By importing modules, you can reuse code, organize related functionality, and extend the capabilities of your program. Python provides a rich ecosystem of built-in and third-party modules that cover a wide range of tasks and domains, including math, file I/O, networking, and more. The import statement is essential for leveraging this existing functionality and building powerful Python applications.
Related Questions on Introduction to Python
What is Python primarily used for?
A. Web browsing
B. Data analysis
C. Video editing
D. Game development
Who developed Python Programming Language?
A. Wick van Rossum
B. Rasmus Lerdorf
C. Guido van Rossum
D. Niene Stom
Which of the following is an advantage of Python?
A. It compiles to machine code
B. It enforces strict typing
C. It has a large standard library
D. It requires extensive memory management
What is the role of the Python interpreter?
A. To convert Python code to assembly language
B. To manage memory allocation
C. To execute Python code line by line
D. To compile Python code into bytecode

Join The Discussion