DEV Community

Cover image for Machine Learning Log: how Python works in 1 minute or less

Posted on

Machine Learning Log: how Python works in 1 minute or less

Python is a general purpose programming language that is popularly used for Machine Learning, so I am spending some time getting acquainted with its syntax, before continuing my exploration of Machine Learning.

Today I will start with a brief explanation of how Python works behind the scenes. How does the computer know what to do with the instructions you write in Python?

Python is a high level programming language, which means that it doesn't communicate directly with the computer. Because Python's syntax is similar to natural language, it is pretty easy to write code in, compared to a language like C, which requires more instructions to get the computer to do something. This means less lines of code for the programmer to write, which makes it a time-saver.

After the programmer writes the source code, the code is translated into something called bytecode, and then executed on a Virtual Machine (rather than being translated into binary and being executed by the CPU). The machine completes the tasks that are laid out in the code, and the programmer sees the results.

So, for example, let's say we write an extremely simple program:

print('Hey there, does this make any sense?')

The compiler takes that and translates it into bytecode. The btyecode is executed by an interpreter. And then we see this on the screen:

Hey there, does this make any sense?

And that's a very basic overview of how Python works behind the scenes.

Top comments (1)

matoval profile image

I'm a JavaScript Developer and wrote Python for the first time this weekend, I built a web scraper that gets all the developer jobs for all the US from Craigslist. It was fairly easy to get it working. I ended up writing an article about how I built it.