I've started learning Python, and I thought it would be a good idea to share what I learn every day. Writing things down should help me understand the concepts better, and maybe it will help other beginners too.
I missed the first class, so I'm catching up on the basics before moving forward.
What is Python?
Python is a high-level, general-purpose programming language. One thing I like about Python is that its syntax is easy to read compared to many other programming languages.
It is used in different fields, such as:
- Web development
- Artificial intelligence and machine learning
- Data science
- Automation
- Software development
Let's start with a simple example.
print("Hello, World!")
Output:
Hello, World!
The print() function displays the message on the screen. Pretty simple, right?
How does Python work?
This was one of the interesting topics I wanted to understand.
When we write code, the computer cannot directly execute our Python source code as written. In the commonly used CPython implementation, the code goes through a process involving parsing, compilation into bytecode, and execution.
Here is a simplified view of the process:
Python source code → Parsing and compilation → Bytecode → Python Virtual Machine (PVM) → Output
1. Python source code
This is the code we write in a .py file.
2. Parsing and compilation
Python checks the syntax and compiles valid code into bytecode.
3. Bytecode
Bytecode is an intermediate form of instructions generated from our Python code.
4. Python Virtual Machine (PVM)
The PVM executes the bytecode instructions.
5. Output
Finally, we get the result of our program.
For example, when we run print("Hello, World!"), the output is displayed in the terminal.
This is a simplified explanation of how CPython works, but it helped me understand the basic execution flow.
What I learned today
- What Python is and where it is used.
- How to print output using
print(). - The basic process Python follows to execute a program.
- What bytecode and the Python Virtual Machine do.

Top comments (0)