DEV Community

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

Posted on

5

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.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (1)

Collapse
 
matoval profile image
matoval

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.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay