Python_day1

Background:

I am totally a layman of python. Of course I know it is a programming language and it is popular. There are millions and millions people who can use python in the world but for me. I have to learn it immediately because I have no time to wait and to waste.

Beginning

Today I downloaded the Python_3.8 and installed it. This task is easy.
I followed the instruction from Liaoxuefeng https://www.liaoxuefeng.com/wiki/1016959663602400 and read a python book named Snake Wrangling for Kids. I suppose I am a kid too in this filed.

image.png

I guess the 2nd file Python 3.8(64-bit) is the python interpreter. that is where we write the Python code and run it.

An interpreter is a program that converts the code a developer writes into an intermediate language, called the byte code. It converts the code line by line, one at a time. It translates till the end and stops at that line where an error occurs, if any, making the debugging process easy.

Well, my python interpreter is a CPython interpreter.
The following paragraph describes how a Python interpreter works. I can't understand it completely now but one day I will.

What happens when you run a Python Code?
On running a Python code, say a simple program that prints “Hello, World!”, then the following steps happen:

  1. The program gets converted into an intermediate code, called bytecode. This is also binary but is not understood by the processor.
  2. Python Interpreter, stored in the memory as a collection of instructions in binary form, does the above conversion. These instructions can be thought of as a combination of a compiler and a Python Virtual Machine (PVM).
  3. The compiler converts the source code, the “Hello, World!” program, into the byte code, which is platform-independent and understood by the PVM.
  4. PVM reads the byte code and executes it on the hardware, the job of a processor.

Interactive mode is a command line shell which gives immediate feedback for each statement, while running previously fed statements in active memory. As new lines are fed into the interpreter, the fed program is evaluated both in part and in whole. Interactive mode is a good way to play around and try variations on syntax.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容