Is Python code compiled or interpreted?
A. Python code is both compiled and interpreted
B. Python code is neither compiled nor interpreted
C. Python code is only compiled
D. Python code is only interpreted
Answer: Option A
Solution (By Examveda Team)
Python code is both compiled and interpreted.When you run a Python script, the source code is first compiled into bytecode by the Python interpreter. This bytecode is then executed by the Python Virtual Machine (PVM). Thus, Python combines elements of both compilation and interpretation. The compilation step translates the human-readable source code into bytecode, while the interpretation step executes the bytecode instructions. This hybrid approach allows Python to achieve a balance between performance and flexibility.
Join The Discussion