Anjum Javed
last year
Anjumcountry asked

What is an interpreter and a compiler, and why do people say Python is an interpreted language?

Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Anjum Javed,

A compiler translates your whole program into machine code first, then you run the compiled program. This is common in languages like C and C++.

An interpreter runs your code by reading it and executing it step by step, so you can run your program right away without a separate build step.

Python is often called interpreted because you usually run .py files directly using the Python interpreter. One extra detail that helps: Python first converts your code into bytecode, then the Python interpreter runs that bytecode for you. So you still get the simple run-it-now experience.

If you have more questions, I am here to help 😊

Python
This question was asked as part of the Getting started with Python course.